Skip to content

[Feature Request] WAM should return error code in hexadecimal #778

Open

Description

@jiasli

MSAL client type

Public

Problem Statement

Currently, WAM returns error code in decimal, resulting in negative numbers, such as -2147023584, -2147221164. Their corresponding hexadecimal values are 0x80070520, 0x80040154.

Even https://aka.ms/errors recommends using hex:

🤔 Inverting error code: query was -2147221164 which is more commonly expressed as 0x80040154.

In a search engine, - usually means "not to include". Searching for -2147221164 gives no result:

https://www.google.com/search?q=-2147221164

image

Proposed solution

WAM should return error code in hexadecimal.

Activity

  1. jiasli commented on Jan 2, 2025

    @jiasli
    ContributorAuthor

    The minus sign - is in those error codes does not really mean negative numbers. It is due to treating memory bytes as signed integers.

    To convert theme back, we can use below Python code:

    print((-2147023584).to_bytes(4, signed=True).hex())
    print((-2147221164).to_bytes(4, signed=True).hex())
    
    # output
    80070520
    80040154

    See

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions