Skip to content

Commit beb8de4

Browse files
authored
Merge pull request #11 from takker99/errors
Add Error types
2 parents 9a71056 + 098660a commit beb8de4

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

api/error.ts

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
1-
export type NotMemberError = {
1+
/** Scrapbox REST APIが返すエラーの型 */
2+
export interface ErrorLike {
3+
/** error name */ name: string;
4+
/** error message */ message: string;
5+
}
6+
7+
/** 参加していないprivate projectに対してAPIを叩いたときに発生するエラー */
8+
export interface NotMemberError extends ErrorLike {
29
name: "NotMemberError";
3-
message: string;
4-
};
10+
}
511

6-
export type NotFoundError = {
12+
/** 指定したprojectやpageが見つからないときに発生するエラー */
13+
export interface NotFoundError extends ErrorLike {
714
name: "NotFoundError";
8-
message: string;
9-
};
15+
}
16+
17+
/** owner/admin権限が不足しているときに発生するエラー */
18+
export interface NotPrivilegeError extends ErrorLike {
19+
name: "NotPrivilegeError";
20+
}
21+
22+
/** Loginが必要なAPIをloginせずに叩いたときに発生するエラー */
23+
export interface NotLoggedInError extends ErrorLike {
24+
name: "NotLoggedInError";
25+
/** 詳細情報 */ details: {
26+
/** 使用できるログイン方法 */ loginStrategies: (
27+
| "google"
28+
| "github"
29+
| "microsoft"
30+
| "gyazo"
31+
| "email"
32+
| "saml"
33+
| "easy-trial"
34+
)[];
35+
};
36+
}

0 commit comments

Comments
 (0)