https.HttpsError class
Stay organized with collections
Save and categorize content based on your preferences.
An explicit error that can be thrown from a handler to send an error to the client that called the function.
Signature:
export declare class HttpsError extends Error
Extends: Error
Constructors
Properties
Property |
Modifiers |
Type |
Description |
code |
|
FunctionsErrorCode |
A standard error code that will be returned to the client. This also determines the HTTP status code of the response, as defined in code.proto. |
details |
|
unknown |
Extra data to be converted to JSON and included in the error response. |
httpErrorCode |
|
HttpErrorCode |
A wire format representation of a provided error code. |
Methods
Method |
Modifiers |
Description |
toJSON() |
|
Returns a JSON-serializable representation of this object. |
https.HttpsError.(constructor)
Constructs a new instance of the HttpsError
class
Signature:
constructor(code: FunctionsErrorCode, message: string, details?: unknown);
Parameters
https.HttpsError.code
A standard error code that will be returned to the client. This also determines the HTTP status code of the response, as defined in code.proto.
Signature:
readonly code: FunctionsErrorCode;
https.HttpsError.details
Extra data to be converted to JSON and included in the error response.
Signature:
readonly details: unknown;
https.HttpsError.httpErrorCode
A wire format representation of a provided error code.
Signature:
readonly httpErrorCode: HttpErrorCode;
https.HttpsError.toJSON()
Returns a JSON-serializable representation of this object.
Signature:
toJSON(): HttpErrorWireFormat;
Returns:
HttpErrorWireFormat
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-24 UTC.
[null,null,["Last updated 2023-04-24 UTC."],[],[],null,["# https.HttpsError class\n\nAn explicit error that can be thrown from a handler to send an error to the client that called the function.\n\n**Signature:** \n\n export declare class HttpsError extends Error \n\n**Extends:** Error\n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|--------------------------------------------------------------------------------------------------------------|-----------|-----------------------------------------------------|\n| [(constructor)(code, message, details)](./firebase-functions.https.httpserror.md#httpshttpserrorconstructor) | | Constructs a new instance of the `HttpsError` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|----------------------------------------------------------------------------------------|-----------|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [code](./firebase-functions.https.httpserror.md#httpshttpserrorcode) | | [FunctionsErrorCode](./firebase-functions.https.md#httpsfunctionserrorcode) | A standard error code that will be returned to the client. This also determines the HTTP status code of the response, as defined in code.proto. |\n| [details](./firebase-functions.https.httpserror.md#httpshttpserrordetails) | | unknown | Extra data to be converted to JSON and included in the error response. |\n| [httpErrorCode](./firebase-functions.https.httpserror.md#httpshttpserrorhttperrorcode) | | HttpErrorCode | A wire format representation of a provided error code. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|----------------------------------------------------------------------------|-----------|------------------------------------------------------------|\n| [toJSON()](./firebase-functions.https.httpserror.md#httpshttpserrortojson) | | Returns a JSON-serializable representation of this object. |\n\nhttps.HttpsError.(constructor)\n------------------------------\n\nConstructs a new instance of the `HttpsError` class\n\n**Signature:** \n\n constructor(code: FunctionsErrorCode, message: string, details?: unknown);\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|-----------------------------------------------------------------------------|-------------|\n| code | [FunctionsErrorCode](./firebase-functions.https.md#httpsfunctionserrorcode) | |\n| message | string | |\n| details | unknown | |\n\nhttps.HttpsError.code\n---------------------\n\nA standard error code that will be returned to the client. This also determines the HTTP status code of the response, as defined in code.proto.\n\n**Signature:** \n\n readonly code: FunctionsErrorCode;\n\nhttps.HttpsError.details\n------------------------\n\nExtra data to be converted to JSON and included in the error response.\n\n**Signature:** \n\n readonly details: unknown;\n\nhttps.HttpsError.httpErrorCode\n------------------------------\n\nA wire format representation of a provided error code.\n\n**Signature:** \n\n readonly httpErrorCode: HttpErrorCode;\n\nhttps.HttpsError.toJSON()\n-------------------------\n\nReturns a JSON-serializable representation of this object.\n\n**Signature:** \n\n toJSON(): HttpErrorWireFormat;\n\n**Returns:**\n\nHttpErrorWireFormat"]]