How to get Model Name/Class in Exception Handler #3946
-
I need to know when 'E_ROW_NOT_FOUND' is thrown, what model is the error coming from, so I can tell User what model/data can't be found. if (error.code === 'E_ROW_NOT_FOUND') {
return ctx.response.send({
'status': 400,
'message': 'Failed. ' + error.getPreviousClass() + ' Not Found.' // Something like this?
})
} In Laravel, I could do something like |
Beta Was this translation helpful? Give feedback.
Answered by
radiumrasheed
Dec 23, 2024
Replies: 2 comments 4 replies
-
It is not possible right now. However, feel free to open a PR in the Lucid repo https://github.com/adonisjs/lucid |
Beta Was this translation helpful? Give feedback.
3 replies
-
@TheArKaID In the next release, we should be able to use |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
TheArKaID
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@TheArKaID In the next release, we should be able to use
error.model.name