Skip to content

Commit

Permalink
fix: catch errors in fs-router fixes #100
Browse files Browse the repository at this point in the history
  • Loading branch information
nksaraf committed Feb 12, 2024
1 parent 23e4217 commit d340f16
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/vinxi/lib/fs-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,14 @@ export class BaseFileSystemRouter extends EventTarget {
async addRoute(src) {
src = normalize(src);
if (this.isRoute(src)) {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
try {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
}
} catch (e) {
console.error(e);
}
}
}
Expand All @@ -192,10 +196,14 @@ export class BaseFileSystemRouter extends EventTarget {
async updateRoute(src) {
src = normalize(src);
if (this.isRoute(src)) {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
try {
const route = await this.toRoute(src);
if (route) {
this._addRoute(route);
this.reload(route);
}
} catch (e) {
console.error(e);
}
// this.update?.();
}
Expand Down

0 comments on commit d340f16

Please sign in to comment.