mirror of
https://github.com/larksuite/cli.git
synced 2026-07-06 16:18:05 +08:00
Calendar commands now return structured, typed error envelopes for every failure mode — input validation, internal faults, and API responses — instead of legacy generic errors. Callers and AI agents get consistent exit codes and a machine-readable shape (type / subtype / code / hint), and can tell bad input, an internal fault, and an API rejection apart. Validation errors are attributed to the offending flag. Server-supplied error details (e.g. why an event time was rejected) are surfaced on the typed error's hint via a shared classifier improvement that benefits every domain. Multi-step operations (create-with-attendees rollback, multi-field update) preserve the real failure's classification and report which steps completed. The whole calendar domain is now lint-locked against reintroducing legacy error constructors.
17 lines
677 B
Go
17 lines
677 B
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package errclass
|
|
|
|
import "github.com/larksuite/cli/errs"
|
|
|
|
// calendarCodeMeta holds calendar-service Lark code → CodeMeta mappings.
|
|
// Only codes whose meaning is verifiable from repo evidence are registered;
|
|
// ambiguous codes fall back to CategoryAPI via BuildAPIError.
|
|
// BuildAPIError consumes this map via mergeCodeMeta + LookupCodeMeta.
|
|
var calendarCodeMeta = map[int]CodeMeta{
|
|
190014: {Category: errs.CategoryAPI, Subtype: errs.SubtypeInvalidParameters}, // invalid params (carries a field-level detail lifted into Hint)
|
|
}
|
|
|
|
func init() { mergeCodeMeta(calendarCodeMeta, "calendar") }
|