Ajvanho's avatar
Level 14

catching Laravel errors?

My validation error response is this.

{
   "message":"The given data was invalid.",
   "errors":{
      "start":[
         "The start field is required."
      ],
      "end":[
         "The end to field is required."
      ]
   }
}

I read from L News blog that I could catch errors like this, but I dont hava a value?

.catch(e => {
                    this.errors = e.data.errors;
});
0 likes
2 replies
Sergiu17's avatar

Try this

.catch(e => {
	console.log(e);
}

and see what you get, you may need this.errors = e.errors; only, without.data

1 like
Ajvanho's avatar
Level 14

Uncaught (in promise) ReferenceError: errors is not defined

Please or to participate in this conversation.