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

ErrorHandler is not called and an exception is thrown instead #119

Open
darioduetto opened this issue Sep 22, 2020 · 0 comments
Open

ErrorHandler is not called and an exception is thrown instead #119

darioduetto opened this issue Sep 22, 2020 · 0 comments

Comments

@darioduetto
Copy link

The component provides an errorHandler hook so that we can handle errors on our side. But sometimes, there are errors that are not sent through the errorHandler, but are thrown within react-activity-feed instead.

For example we have the "Token is expired" error sometimes being sent to the errorHandler and sometimes for some reason being thrown within the component itself:

react-activity-feed: 0.9.19

Through errorHandler (OK):
Error: {"detail":"Token is expired","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.00ms","more_info":"https://getstream.io/docs/api_error_responses"}

  • react-activity-feed.min.js at line 1:718897
    {snip} case 6:return e.prev=6,e.t0=e.catch(0),i.props.errorHandler(e.t0,"get-notification-counts",{feedGroup:i.props.feedGroup,userId:i.props.userI {snip}

  • react-activity-feed.min.js in u at line 21:28239
    {snip} ,r),o}function u(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f="suspendedStart",_="su {snip}

  • react-activity-feed.min.js at line 21:28024
    {snip} se"return"===i.method&&i.abrupt("return",i.arg);a=d;var l=u(e,t,i);if("normal"===l.type){if(a=i.done?h:_,l.arg===g)continue;return{value:l.a {snip}

  • react-activity-feed.min.js in i at line 1:3320
    {snip} ult},function(e,t){function i(e,t,i,a,n,o,r){try{var s=e[o](r),l=s.value}catch(e){return void i(e)}s.done?t(l):Promise.resolve(l).then(a,n)} {snip}

  • react-activity-feed.min.js in l at line 1:3567
    {snip} ly(t,a);function s(e){i(r,n,o,s,l,"next",e)}function l(e){i(r,n,o,s,l,"throw",e)}s(void 0)})}}},function(e,t,i){var a=i(335),n=i(336),o=i(33 {snip}

Within component (not handled):
Error: {"detail":"Token is expired","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.00ms","more_info":"https://getstream.io/docs/api_error_responses"} with HTTP status code 403

  • react-activity-feed.min.js in i.StreamApiError.o at line 1:6012
    {snip} (e,t){this.message=e,Error.call(this,this.message),a?Error.captureStackTrace(this,t):this.stack=n?(new Error).stack:""}i._Abstract=o,o.proto {snip}

  • react-activity-feed.min.js in new i.StreamApiError at line 1:6394
    {snip} eamApiError=function(e,t,i){this.error=t,this.response=i,o.call(this,e)},i.StreamApiError.prototype=new o},function(e,t,i){var a=i(39),n=i(2 {snip}

  • react-activity-feed.min.js in Object.callback at line 21:37802
    {snip} u.StreamApiError(e,r,o)):/^2/.test(""+o.statusCode)?t(r):i(new u.StreamApiError(JSON.stringify(r)+" with HTTP status code "+o.statusCode,r,o {snip}

  • react-activity-feed.min.js at line 1:897283
    {snip} ON.parse(t.responseText)}catch(i){return e.callback(i,t)}e.callback(null,t,t.body)}}())},t.open(e.method,e.uri,!0),r&&(t.withCredentials=!!e {snip}

  • react-activity-feed.min.js in XMLHttpRequest.t.onreadystatechange at line 1:897308
    {snip} catch(i){return e.callback(i,t)}e.callback(null,t,t.body)}}())},t.open(e.method,e.uri,!0),r&&(t.withCredentials=!!e.withCredentials);for(var {snip}

It seems that for some reason, there are errors not being handled and thrown directly through a different flow.

Any help will be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant