Skip to content

Angular throws a http errors in browser console even if they are caught in application #1

@someApprentice

Description

@someApprentice

When authorization is failed API respond 404 status code and for this case an applications catches an error

https://github.com/someApprentice/Crypter/blob/master/src/app/auth/auth.service.ts#L36
https://github.com/someApprentice/Crypter/blob/master/src/app/auth/auth.service.ts#L61-L63

But somehow Angular throws the error anyway

POST http://localhost:4000/api/login 404 (Not Found)
_ @ polyfills.1ef83d22ada557f4a131.js:1
n.scheduleTask @ polyfills.1ef83d22ada557f4a131.js:1
onScheduleTask @ polyfills.1ef83d22ada557f4a131.js:1
n.scheduleTask @ polyfills.1ef83d22ada557f4a131.js:1
t.scheduleTask @ polyfills.1ef83d22ada557f4a131.js:1
t.scheduleMacroTask @ polyfills.1ef83d22ada557f4a131.js:1
p @ polyfills.1ef83d22ada557f4a131.js:1
(anonymous) @ polyfills.1ef83d22ada557f4a131.js:1
H.a.(anonymous function) @ polyfills.1ef83d22ada557f4a131.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
t._trySubscribe @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
J @ main.1ce17900a4d53c7a028c.js:1
e._innerSub @ main.1ce17900a4d53c7a028c.js:1
e._tryNext @ main.1ce17900a4d53c7a028c.js:1
e._next @ main.1ce17900a4d53c7a028c.js:1
e.next @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
t._trySubscribe @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
t.call @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
t.call @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
t.call @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
t.call @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
t.call @ main.1ce17900a4d53c7a028c.js:1
t.subscribe @ main.1ce17900a4d53c7a028c.js:1
t.login @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
handleEvent @ main.1ce17900a4d53c7a028c.js:1
handleEvent @ main.1ce17900a4d53c7a028c.js:1
ea @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
e.object.o @ main.1ce17900a4d53c7a028c.js:1
e.__tryOrUnsub @ main.1ce17900a4d53c7a028c.js:1
e.next @ main.1ce17900a4d53c7a028c.js:1
e._next @ main.1ce17900a4d53c7a028c.js:1
e.next @ main.1ce17900a4d53c7a028c.js:1
e.next @ main.1ce17900a4d53c7a028c.js:1
e.emit @ main.1ce17900a4d53c7a028c.js:1
e.onSubmit @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
handleEvent @ main.1ce17900a4d53c7a028c.js:1
handleEvent @ main.1ce17900a4d53c7a028c.js:1
ea @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
(anonymous) @ main.1ce17900a4d53c7a028c.js:1
n.invokeTask @ polyfills.1ef83d22ada557f4a131.js:1
onInvokeTask @ main.1ce17900a4d53c7a028c.js:1
n.invokeTask @ polyfills.1ef83d22ada557f4a131.js:1
t.runTask @ polyfills.1ef83d22ada557f4a131.js:1
t.invokeTask @ polyfills.1ef83d22ada557f4a131.js:1
k @ polyfills.1ef83d22ada557f4a131.js:1
g @ polyfills.1ef83d22ada557f4a131.js:1

Importing the zone.js/dist/zone-error in environment files doesn't actually affects anything.

This behavior isn't occurs in the test environment via Karma/Jasmine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions