Code Monkey home page Code Monkey logo

Comments (2)

melinda-hl-lim avatar melinda-hl-lim commented on May 30, 2024

I've found the issue and some behaviour I don't understand.

Originally, the only error the would be displayed was the error from creating an IAM group and user with a reused name. This error came from Amazon and is of type string.

The other errors that I am able to invoke but were not being displayed include:

  • creating VPCs: reaching the maximum number of VPCs allowed
  • creating a subnet: giving an incorrect availability zone
  • creating EFS: reusing a creation token
    All of these errors are of type object. The Ora spinner expects a string, which is why the spinner couldn't display the error message.

To fix this issue, I have created a utility method stringifyErrorMsg that checks for the type of error. If it receives an object, it retrieves the string at the key stderr and returns it.

Unknown behaviour

The other errors I can invoke are of type object because they are being returned by the catch block in executeProcess.js. However, the error from creating the IAM group and user are being returned by the if statement inside the try block. I don't understand why these errors are being handled differently.

from gander-cli.

melinda-hl-lim avatar melinda-hl-lim commented on May 30, 2024

I investigated the unknown behaviour more by invoking as many errors as I could in as many AWS API calls as possible, namely by passing in false IDs, and have come to conclude the following about the unknown behaviour.

All errors we receive seem to be returned by the catch block. As soon as the executed bash script fails, the code moves on to the catch block, skipping all code in the try block following the script execution.

However, the error received from reusing an IAM group and user name is not caught by the catch block. Thus, the if statement inside the try block - is the only place that it will get caught. I don't know why this one particular error that I can invoke isn't caught.

I don't understand why this behaviour happens, but it does.

from gander-cli.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.