docs: Add docs for errors

This commit is contained in:
Sojin Park 2024-08-11 21:38:32 +09:00
parent 418183b0aa
commit f99a6b26c3
9 changed files with 99 additions and 0 deletions

View File

@ -214,6 +214,13 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'padStart (compat)', link: '/reference/compat/string/padStart' },
],
},
{
text: 'Errors',
items: [
{ text: 'AbortError', link: '/reference/error/AbortError' },
{ text: 'TimeoutError', link: '/reference/error/TimeoutError' },
],
},
],
},
];

View File

@ -227,6 +227,13 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'padStart (호환성)', link: '/ko/reference/compat/string/padStart' },
],
},
{
text: '에러',
items: [
{ text: 'AbortError', link: '/ko/reference/error/AbortError' },
{ text: 'TimeoutError', link: '/ko/reference/error/TimeoutError' },
],
},
],
},
];

View File

@ -209,6 +209,13 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'padStart (兼容性)', link: '/zh_hans/reference/compat/string/padStart' },
],
},
{
text: '错误',
items: [
{ text: 'AbortError', link: '/zh_hans/reference/error/AbortError' },
{ text: 'TimeoutError', link: '/zh_hans/reference/error/TimeoutError' },
],
},
],
},
];

View File

@ -0,0 +1,13 @@
# AbortError
작업이 중단되거나 취소되었을 때 던져지는 에러예요.
[debounce](../function/debounce.md)나 [delay](../promise/delay.md)와 같은 작업이 `AbortSignal`로 취소되었을 때 던져져요.
## 인터페이스
```typescript
class AbortError extends Error {
name = 'AbortError',
}
```

View File

@ -0,0 +1,13 @@
# TimeoutError
제한 시간이 지났을 때 던져지는 에러예요.
[timeout](../promise/timeout.md)나 [withTimeout](../promise/withTimeout.md) 같은 작업의 제한 시간이 지났을 때 던져져요.
## 인터페이스
```typescript
class TimeoutError extends Error {
name = 'TimeoutError',
}
```

View File

@ -0,0 +1,13 @@
# AbortError
An error class representing an operation that was aborted.
It occurs when operations like [debounce](../function/debounce.md) or [delay](../promise/delay.md) are aborted using `AbortSignal`s.
## Interface
```typescript
class AbortError extends Error {
name = 'AbortError',
}
```

View File

@ -0,0 +1,13 @@
# TimeoutError
An error class representing an timeout.
It occurs when operations like [timeout](../promise/timeout.md) or [withTimeout](../promise/withTimeout.md) have timed out.
## Interface
```typescript
class TimeoutError extends Error {
name = 'TimeoutError',
}
```

View File

@ -0,0 +1,13 @@
# AbortError
一个表示操作被中止的错误类。
当像 [debounce](../function/debounce.md) 或 [delay](../promise/delay.md) 这样的操作通过 `AbortSignal` 被中止时,会发生此错误。
## 接口
```typescript
class AbortError extends Error {
name = 'AbortError',
}
```

View File

@ -0,0 +1,13 @@
# TimeoutError
一个表示超时的错误类。
当像 [timeout](../promise/timeout.md) 或 [withTimeout](../promise/withTimeout.md) 这样的操作超时时,会发生此错误。
## 接口
```typescript
class TimeoutError extends Error {
name = 'TimeoutError',
}
```