File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 77
88import axios from "axios" ;
99import _get from "lodash/get" ;
10+ import _isEmpty from "lodash/isEmpty" ;
1011
1112const BASE_HEADERS = {
1213 "json" : { "Content-Type" : "application/json" } ,
@@ -108,7 +109,7 @@ export class RDMDepositApiClient extends DepositApiClient {
108109 error . response . data . errors || [ ]
109110 ) ;
110111 // this is to serialize raised error from the backend on publish
111- if ( errors ) errorData = errors ;
112+ if ( ! _isEmpty ( errors ) ) errorData = errors ;
112113 throw new DepositApiClientResponse ( { } , errorData ) ;
113114 }
114115 }
Original file line number Diff line number Diff line change @@ -211,8 +211,9 @@ class DisconnectedFormFeedback extends Component {
211211 ? "suggestive"
212212 : initialFeedback ;
213213
214- // if no field is specified on the backend, then the message is on the `_schema` field
215- const backendErrorMessage = errors . _schema ;
214+ // if no field is specified on the backend, then the validation message is on the `_schema` field
215+ // if the backend returns an explicit message e.g server error, then we use that instead of the default one
216+ const backendErrorMessage = errors . message || errors . _schema ;
216217
217218 // Retrieve the corresponding icon and type if the feedback is a valid key,
218219 // else fallback to warning.
You can’t perform that action at this time.
0 commit comments