File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ declare type BaseExceptionResponse = {
88 status : number ;
99 message : string ;
1010 code : string ;
11+ errors ?: Record < string , string > ;
1112} ;
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ export const api = (context?: GetServerSidePropsContext) => {
3030 } ,
3131 ( error ) => {
3232 if ( axios . isAxiosError ( error ) ) {
33+ if ( error . response ?. data . errors ) {
34+ return Promise . reject ( error ) ;
35+ }
36+
3337 const httpException = HTTPExceptionAdapter . fromAxiosError ( error ) ;
3438
3539 reportErrorToSentry ( httpException , {
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ export const postRecommendation = async (requestBody: PostRecommendationRequestB
1717 const { data : response } = await api ( ) . post < BaseResponse < void > > ( "/recommendations" , requestBody ) ;
1818 return response . data ;
1919 } catch ( error ) {
20+ if ( isAxiosError ( error ) && error . response ?. data ?. errors ) {
21+ throw error ;
22+ }
23+
2024 if ( ! isAxiosError ( error ) ) throw error ;
2125 throw HTTPExceptionAdapter . fromAxiosError ( error ) ;
2226 }
Original file line number Diff line number Diff line change @@ -42,8 +42,10 @@ export const InputFieldSet = ({
4242 ) }
4343 />
4444 { desc && < p className = "mt-1 text-sm text-gray-500" > { desc } </ p > }
45- { error && < ErrorMessage error = { error } /> }
46- { success && < SuccessMessage success = { success } /> }
45+ < div className = "mt-1 h-5" >
46+ { error && < ErrorMessage error = { error } /> }
47+ { success && < SuccessMessage success = { success } /> }
48+ </ div >
4749 </ fieldset >
4850 ) ;
4951} ;
You can’t perform that action at this time.
0 commit comments