Can you read the HttpsError status of a firebase function?

I have a firebase function in which I manually throw an error with a status and message like this:

throw new functions.https.HttpsError('permission-denied', 'Token does not match');

The response I get from the server looks like this (using chrome dev console):

{"error":{"message":"Token does not match","status":"PERMISSION_DENIED"}}

But when I call the function like this, the error does not have a status in it (using AngularFire2):

try {
    return await this.functions.httpsCallable<void, void>('testFunc')().toPromise();
} catch (e) {
    console.log(e.name); // "Error"
    console.log(e.message); // "Token does not match"
    console.log(e.status); // undefined
}

Is there any way to get the status of it, because I would rather check for if(e.status == 'PERMISSION_DENIED') than if(e.message == 'Token does not match').

Answer

e is going to be a HttpsError object. As you can see from the API docs, it should have a property called code which is a FunctionsErrorCode object that contains the HTTP status code as a string that should match what you threw from the callable function. So I would expect e.code to be the string permission-denied.