keecode logokeecode
9

Invalid Argument

Invalid argument

Node.js

Exit Code Information

Exit Code

9

Name

Invalid Argument

Category

Node.js

Usage Context

Unknown option or invalid value for option

Common Usage

Bash Script

#!/bin/bash

if [ condition ]; then
  echo "Invalid Argument"
  exit 9
fi

Check Exit Code

./script.sh
echo $?  # Prints the exit code

# Check if exit code matches
if [ $? -eq 9 ]; then
  echo "Invalid Argument"
fi

Node.js/JavaScript

// Exit with code 9
process.exit(9);

// Or throw error that results in exit code
if (error) {
  console.error('Invalid Argument');
  process.exit(9);
}

Python

import sys

# Exit with code 9
if error:
    print("Invalid Argument")
    sys.exit(9)