Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(org status): improve err handling #845

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Conversation

cristiand391
Copy link
Member

What does this PR do?

Improves error handler when trying to get status of an org.
before:
org list would check for <html> in err message
after:
org list will check for html or <!DOCTYPE HTML> to ensure it got an HTML response from the server.

Repro:
modify the instance url (make it point to an invalid url) of a non-hub org in its auth file, then run sf org list

What issues does this PR fix or reference?

forcedotcom/cli#2533
@W-14348441@

stubMethod(sandbox, Org.prototype, 'refreshAuth').rejects({
message: `
<!DOCTYPE HTML>
<html lang=en-US>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the error sfdx-core got when trying to resolve my dev ed org with an invalid instance URL.
plugin-org looks for <html> so it doesn't catch these HTML responses (html tag with attributes>). Now will also look for <!DOCTYPE HTML>.

with org api:

➜  plugin-org git:(cd/improve-html-res-handle) sf org api 'services/data/v59.0/'
Error (1): <!DOCTYPE HTML>
<html lang=en-US>
<head>
<meta charset=UTF-8>
<title>Error Page</title>
    <style>
        /*! normalize.css v3.0.2 | MIT License | git.io/normalize */

        html {
            font-family: sans-serif;
            -ms-text-size-adjust: 100%;
            -webkit-text-size-adjust: 100%
        }

        body {
            margin: 0
        }

        article,
        aside,
        details,
        figcaption

@mshanemc mshanemc merged commit 1fb7aae into main Oct 23, 2023
11 checks passed
@mshanemc mshanemc deleted the cd/improve-html-res-handle branch October 23, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants