Stack trace not available in development mode


#1

Hi
In my .env file I set NODE_ENV to development but adonisjs always returns 1 line of error and there is no stack trace for errors

How can I fix this ?


#2

hello @Ali-Azmoud can you show the error from adonis ?


#3

sure, here is what I get. an example

Capture

I want adonis display errors like this image


#4

Does your app have its own global exception handler ?


#5

If you mean there is a directory inside app named Exceptions , Yes

and inside of it there is a file named Handler.js which contains this script:

'use strict'

const BaseExceptionHandler = use('BaseExceptionHandler')

class ExceptionHandler extends BaseExceptionHandler {

  async handle (error, { request, response }) {
    response.status(error.status).send(error.message)
  }
  
  async report (error, { request }) {
  }
}

module.exports = ExceptionHandler

and something else ( not related to this question ), is there any chance to have wantsJson() function in the next version of adonisjs


#6

well, thank you, I removed Exceptions directory and its working as expected.

// this line was behind of my problem ! :grinning:
response.status(error.status).send(error.message)