Skip to content

[SEMVER-MAJOR] Implement strong error handler for rest-adapter - #302

Merged
davidcheung merged 1 commit into
masterfrom
implement-strong-error-handler
Jun 7, 2016
Merged

[SEMVER-MAJOR] Implement strong error handler for rest-adapter#302
davidcheung merged 1 commit into
masterfrom
implement-strong-error-handler

Conversation

@davidcheung

@davidcheung davidcheung commented May 16, 2016

Copy link
Copy Markdown
Contributor

Using new strong-error-handler for rest-adapter

connect to https://github.com/strongloop-internal/scrum-loopback/issues/852

  • 3.0-RELEASE-NOTES.md

Comment thread test/rest.test.js Outdated
});

it('should disable stack trace', function(done) {
it.skip('should disable stack trace', function(done) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is for process.env.NODE_ENV = 'production';
do we still want to support this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please remove this test.

@davidcheung davidcheung added #wip and removed #review labels May 16, 2016
@davidcheung davidcheung changed the title [WIP] Implement strong error handler for rest-adapter [SEMVER-MAJOR] Implement strong error handler for rest-adapter May 18, 2016
@davidcheung

Copy link
Copy Markdown
Contributor Author

@bajtos PTAL

@davidcheung davidcheung added #review and removed #wip labels May 18, 2016
@bajtos

bajtos commented May 18, 2016

Copy link
Copy Markdown
Member

@davidcheung I added two commits improving release notes, PTAL 751e708, 40e3d04. Feel free to squash them into your commit and dropping my authorship along the way.

Comment thread 3.0-RELEASE-NOTES.md
You can learn more about the rationale behind the new handler in
[this comment](https://github.com/strongloop/loopback/issues/1650#issuecomment-161920555)

User can specific options in their applications in `config.json` as follow:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about this? I think a better option is to configure strong-remoting's error handler via server/middleware.json, but we may not be there yet.

{
  "routes": {
    "loopback#rest": {
      "params": {
        "debug": true,
        "log": true
      }
   }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm it works in my sand-box
i think the behavior comes from

root.use(RestAdapter.errorHandler(this.remotes.options.errorHandler));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can update this when we change it to use middleware.json?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already using middleware.json. But never mind, let's leave this out of scope of this pull request and stay consistent with the current state of affairs (i.e. configure it via server/config.json).

@bajtos

bajtos commented May 18, 2016

Copy link
Copy Markdown
Member

@davidcheung reviewed.

@davidcheung
davidcheung force-pushed the implement-strong-error-handler branch from a459390 to 4e1e6a0 Compare May 19, 2016 03:42
@davidcheung davidcheung assigned bajtos and unassigned davidcheung May 19, 2016
@davidcheung

Copy link
Copy Markdown
Contributor Author

@bajtos PTAL again

Comment thread 3.0-RELEASE-NOTES.md Outdated
"restApiRoot": "/api",
"host": "0.0.0.0",
"port": 3000,
"errorHandler": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more question though, I think errorHandler should be nested under remoting, could you please check?

{
  "restApiRoot": "/api",
  "remoting": {
    "errorHandler": {
      "debug": true
    }
  }
}

@davidcheung davidcheung May 20, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, the one I have was wrong, fixed.

@bajtos bajtos assigned davidcheung and unassigned bajtos May 19, 2016
@bajtos

bajtos commented May 19, 2016

Copy link
Copy Markdown
Member

Looks mostly good, I left two more comments to address.

@davidcheung
davidcheung force-pushed the implement-strong-error-handler branch from 4e1e6a0 to 41bf6f7 Compare May 20, 2016 14:24
@davidcheung

Copy link
Copy Markdown
Contributor Author

Thanks @bajtos! I have addressed your comments PTAL

@davidcheung davidcheung removed their assignment May 20, 2016
Comment thread 3.0-RELEASE-NOTES.md
}
}
}
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a link to strong-error-handler GH repository, so that people can easily find description of the config options available.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see the link is already included below, ignore this comment.

@bajtos

bajtos commented May 20, 2016

Copy link
Copy Markdown
Member

One nitpick, the rest LGTM. No further review is necessary.

@davidcheung this depends on loopbackio/strong-error-handler#11, doesn't it? Please wait with landing this patch until that required PR is landed first and CI builds are green on our Jenkins. (The jobs on Travis will keep failing because strong-error-handler is not published to npmjs.org yet.)

@bajtos bajtos assigned davidcheung and unassigned bajtos May 20, 2016
@davidcheung

Copy link
Copy Markdown
Contributor Author

yes what should i do with the strong-error-handler version on package.json?

@davidcheung this depends on loopbackio/strong-error-handler#11, doesn't it? Please wait with landing this patch until that required PR is landed first and CI builds are green on our Jenkins. (The jobs on Travis will keep failing because strong-error-handler is not published to npmjs.org yet.)

@bajtos

bajtos commented May 20, 2016

Copy link
Copy Markdown
Member

yes what should i do with the strong-error-handler version on package.json?

Ah, I overlooked that line, please reset it to ^1.0.0. I'll release 1.0.0 when your strong-error-handler pull request is landed.

@davidcheung
davidcheung force-pushed the implement-strong-error-handler branch from 41bf6f7 to 27ba7b3 Compare May 20, 2016 15:47
@davidcheung

Copy link
Copy Markdown
Contributor Author

Please do not merge this yet, my loopback-core module is failing locally but the ci passed
will probably need to submit another PR to loopback core before this should be merged.

@davidcheung

Copy link
Copy Markdown
Contributor Author

@slnode test please

@davidcheung

Copy link
Copy Markdown
Contributor Author

should land with strongloop/loopback#2375 when ready

@bajtos

bajtos commented Jun 1, 2016

Copy link
Copy Markdown
Member

@davidcheung could you please add a note into release notes that error.status property is no longer available and clients should use error.statusCode instead?

@davidcheung
davidcheung force-pushed the implement-strong-error-handler branch from a42ca79 to aa7cb47 Compare June 6, 2016 17:30
@davidcheung

Copy link
Copy Markdown
Contributor Author

@davidcheung davidcheung assigned bajtos and unassigned davidcheung Jun 6, 2016
@bajtos

bajtos commented Jun 7, 2016

Copy link
Copy Markdown
Member

LGTM

@bajtos bajtos assigned davidcheung and unassigned bajtos Jun 7, 2016
@davidcheung
davidcheung force-pushed the implement-strong-error-handler branch from 194cb82 to 5d0dcd2 Compare June 7, 2016 14:51
@davidcheung
davidcheung merged commit 73e7855 into master Jun 7, 2016
@davidcheung
davidcheung deleted the implement-strong-error-handler branch June 7, 2016 15:22
@Amir-61

Amir-61 commented Jun 7, 2016

Copy link
Copy Markdown
Member

@davidcheung Did this patch pass CI? Does this patch require loopback-PR#2375? The reason I'm asking is my PR in loopback#2316 was passing, but it fails with lots of failures now with this commit in strong-remoting; I assume loopback-PR#2375 needs to be landed to fix these failures?

Thanks!

@davidcheung

Copy link
Copy Markdown
Contributor Author

@Amir-61 both PRs depend on each other to pass, I'm currently waiting for CI to run for loopback-PR#2375, once i merge that both sides should pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants