Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error messages not being sent in the response #1528

Closed
marioestradarosa opened this issue Jul 13, 2018 · 2 comments
Closed

Error messages not being sent in the response #1528

marioestradarosa opened this issue Jul 13, 2018 · 2 comments
Labels
bug REST Issues related to @loopback/rest package and REST transport in general

Comments

@marioestradarosa
Copy link
Contributor

marioestradarosa commented Jul 13, 2018

Steps to reproduce

Currently if you point to GET /model/anyvalidvalue such as GET /fruits/200 where the fruit ID 200 does not exist

Current Behavior

You will get only the http status 500, no error message saying "no found with id ". Not even custom error messages are being exposed to the client application.

Relates to #1469

Expected Behavior

Received the correct http err status but most important is that the appropriate error message comes in the json object.

More details and our work around
Our simple solution as app developers to give demos so far was to include the following code in the sequence.ts in our LB4 test application.

From

 } catch (err) {
      this.reject(context, err);
}

To
A temporarily solution for our demos. Note: We tried {expose:true} alone but still didn't work

} catch (err) {
      err = Object.assign({errorMessage: err.message, expose: true}, err);
      this.reject(context, err);
}

With the latter, then LB4 is sending an appropriate message so far in our new property errorMessage. I understand this is just a work around,.

@virkt25
Copy link
Contributor

virkt25 commented Jul 16, 2018

Related to #1469

@virkt25 virkt25 added bug LB4 GA REST Issues related to @loopback/rest package and REST transport in general labels Jul 16, 2018
@dhmlau
Copy link
Member

dhmlau commented Jul 16, 2018

@marioestradarosa, thanks for bringing it up. I'd like to close this ticket in favor of #1469. Please continue the discussion there. Thanks.

@dhmlau dhmlau closed this as completed Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug REST Issues related to @loopback/rest package and REST transport in general
Projects
None yet
Development

No branches or pull requests

3 participants