itd-api / ItdError
Class: ItdError
Defined in: core/errors.ts:67
Базовый класс всех ошибок библиотеки.
Ловить его имеет смысл, чтобы отделить проблемы обращения к итд.com от прочих исключений. Для разбора конкретной причины используйте isItdApiError и поле ItdApiError.code.
Example
ts
try {
await itd.posts.like(id);
} catch (e) {
if (isItdError(e)) console.error('итд.com:', e.message);
else throw e;
}Extends
Error
Extended by
Constructors
Constructor
ts
new ItdError(
kind,
message,
options?): ItdError;Defined in: core/errors.ts:74
Parameters
kind
message
string
options?
cause?
unknown
Returns
ItdError
Overrides
ts
Error.constructorProperties
kind
ts
readonly kind: ItdErrorKind;Defined in: core/errors.ts:72
Категория ошибки.