You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if an operation fails because of a database constraint or what ever, I can't handle them gracefully
asyncadd(op: Operation): Promise<any>{const{ password, ...user}=op.data.attributes;if(!password){throw{// At the very least, you must declare a status and a code.status: HttpStatusCode.BadRequest,title: "A password must be entered.",code: "no_password"}asJsonApiError;}user.salt=uuid()user.hashedPassword=hash(password,user.salt);op.data.attributes=user;try{returnsuper.add({ ...op,params: {}});}catch(e){throw{status: HttpStatusCode.BadRequest,title: "the email already exists",code: "duplicated_user"}asJsonApiError;}}
This is what I would like/expect, but I don't know if its the best approach.
The text was updated successfully, but these errors were encountered:
Currently if an operation fails because of a database constraint or what ever, I can't handle them gracefully
This is what I would like/expect, but I don't know if its the best approach.
The text was updated successfully, but these errors were encountered: