Skip to content

Commit

Permalink
feat: revalidate vip page
Browse files Browse the repository at this point in the history
  • Loading branch information
rowthan committed Jul 27, 2024
1 parent 2f3c2d1 commit a6995cc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/web/pages/vip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export async function getStaticProps() {
props: {
doc: res.props,
plans: plans
}
},
revalidate: 60 * 60 * 4, // 单位 秒
};
}

Expand Down
26 changes: 26 additions & 0 deletions apps/web/utils/Error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class PagenoteError extends Error {
private readonly data: any;
constructor(message:string, data:any) {
super(message); // 调用父类的构造函数
this.name = this.constructor.name; // 设置错误名称
this.message = message; // 错误信息
this.data = data;

// 错误堆栈信息
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = (new Error()).stack;
}

// 执行自定义程序,例如上报服务器
this.reportError();
}

// 自定义方法,用于上报错误
reportError() {
const { data, message } = this;
console.log(`上报错误: ${message}, 数据: ${JSON.stringify(data)}`);

}
}

0 comments on commit a6995cc

Please sign in to comment.