1
0
Fork 0
mirror of https://github.com/archtechx/airwire.git synced 2025-12-12 02:34:04 +00:00

improve error handling

This commit is contained in:
Samuel Štancl 2021-05-21 18:45:19 +02:00
parent 9fffe87970
commit 459b74eb18
3 changed files with 16 additions and 10 deletions

View file

@ -187,7 +187,7 @@ export class Component<AirwireComponent = TypeMap[keyof TypeMap]>
return reason
})
.then((json: ComponentResponse<AirwireComponent>) => { // todo this then() shouldn't execute if previous catch() executes
.then((json: ComponentResponse<AirwireComponent>) => {
if (json?.metadata?.errors) {
this.errors = json.metadata.errors
}
@ -227,7 +227,11 @@ export class Component<AirwireComponent = TypeMap[keyof TypeMap]>
let result = null;
try {
result = callback();
} catch (e) { }
} catch (e) {
this.pausedRequests = false;
throw e
}
this.pausedRequests = false;