Skip to content

Commit

Permalink
fix(@okikio/native): 🐛 add url to request & timeout errors event
Browse files Browse the repository at this point in the history
  • Loading branch information
okikio committed May 28, 2021
1 parent 9aeec2e commit 0be77c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"scss.validate": false,
"conventionalCommits.scopes": [
"demo",
"@okikio/animate"
"@okikio/animate",
"@okikio/native"
],
"npm.packageManager": "pnpm"
}
2 changes: 1 addition & 1 deletion packages/native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ e.g.

```ts
// ...
app.on("REQUEST_ERROR" | "TIMEOUT_ERROR", (err: Error) => {
app.on("REQUEST_ERROR" | "TIMEOUT_ERROR", (err: Error, url: string) => {
// ...
})
```
Expand Down
4 changes: 2 additions & 2 deletions packages/native/src/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class PageManager extends Service {
window.clearTimeout(timeout);

const err = new Error("Request Timed Out!");
this.emitter.emit("TIMEOUT_ERROR", err);
this.emitter.emit("TIMEOUT_ERROR", err, url);
throw err;
}, this.config.timeout);

Expand All @@ -172,7 +172,7 @@ export class PageManager extends Service {
return await response.text();

const err = new Error(response.statusText || "" + response.status);
this.emitter.emit("REQUEST_ERROR", err);
this.emitter.emit("REQUEST_ERROR", err, url);
throw err;
} catch (err) {
window.clearTimeout(timeout);
Expand Down

0 comments on commit 0be77c6

Please sign in to comment.