third_party.pigweed.src/pw_status/ts/status.ts
Wyatt Hepler 0a2c6ba660 pw_status: Consolidate Status docs
- Move the status description from C++ to the docs so there is a single
  description of the status codes that applies to all languages. This
  also allows anywhere in the docs / Doxygen comments to link to the
  status codes.
- Document using status codes in all supported languages.
- Link to the status descriptions in Pigweed's docs from C++, Python,
  and TypeScript.
- Introduce Doxygen alias so status codes can be referenced with
  @pw_status{CODE} in Doxygen comments.

Change-Id: I7a59bc90da9cec09a08376952cf8472e02c67f03
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/136732
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Kayce Basques <kayce@google.com>
2023-04-08 01:08:58 +00:00

40 lines
1.1 KiB
TypeScript

// Copyright 2021 The Pigweed Authors
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
/** Pigweed Status class; mirrors pw::Status.
*
* The status codes are described at
* https://pigweed.dev/pw_status#status-codes. Consult that guide when
* deciding which status code to use.
*/
export enum Status {
OK = 0,
CANCELLED = 1,
UNKNOWN = 2,
INVALID_ARGUMENT = 3,
DEADLINE_EXCEEDED = 4,
NOT_FOUND = 5,
ALREADY_EXISTS = 6,
PERMISSION_DENIED = 7,
RESOURCE_EXHAUSTED = 8,
FAILED_PRECONDITION = 9,
ABORTED = 10,
OUT_OF_RANGE = 11,
UNIMPLEMENTED = 12,
INTERNAL = 13,
UNAVAILABLE = 14,
DATA_LOSS = 15,
UNAUTHENTICATED = 16,
}