Alert On Error - VS Code Extension
🚨 Never miss a terminal failure again! 🚨
This extension provides high-visibility visual and audio alerts whenever a terminal command fails (returns a non-zero exit code). Perfect for busy developers who multitask or run long-running scripts.
Key Features
🔊 Audio Alerts
- Pre-installed Sounds: Choose from a library of funny and professional sounds (Airhorn, Mario Death, CID Dialogue, etc.).
- Automatic Default: Defaults to a high-energy
airhorn.mp3.
- Custom Sound Picker: Easily select any MP3, WAV, M4A, or AAC file from your computer.
- Adjustable Volume: Fine-tune the alert volume to your preference.
🚨 Visual Alerts
- Animated Status Bar Siren: A rapidly toggling emoji siren (
🚨 ERROR 🚨 📢 ERROR 📢 🔴 ERROR 🔴) appears in the status bar on failure.
- Blinking Interface: The entire status bar and title bar blink red and white for 5 seconds, then stay solid red until your next successful command.
- Zero Clutter: No extra tabs or panels—everything happens in the standard VS Code status bar.
Commands
Access these via the Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
Alert On Error: Select Sound: Choose from the built-in sound library.
Alert On Error: Set Custom Sound: Pick a custom audio file from your disk.
Alert On Error: Test Sound: Play the current alert sound to verify your settings.
Alert On Error: Toggle Error Sound: Quickly enable or disable the audio alerts.
Settings
Customize the extension in your settings.json:
{
"alertOnError.enabled": true,
"alertOnError.volume": 0.5,
"alertOnError.statusBarBlink": true,
"alertOnError.selectedSound": "airhorn.mp3",
"alertOnError.customSoundPath": ""
}
Included Sounds
airhorn.mp3 (Default)
Camera_Man_Jaldi_Focus_Karo.mp3
FHAAAAAA.mp3
Mario Death.mp3
Ruko_Jara_Sabar_Karo.mp3
kuch_to_gadbad_hai_daya.mp3
big-explosion.mp3
ghopghop.mp3
Requirements
- VS Code 1.93.0 or higher: Required for the terminal shell execution detection API.
License
MIT - myfilesvivek
Audio Player Requirements
The extension uses system audio players to play sounds:
- Linux: Requires
paplay (PulseAudio), aplay (ALSA), or ffplay (FFmpeg)
- macOS: Uses built-in
afplay
- Windows: Uses PowerShell's SoundPlayer
Installing Audio Players (Linux)
If you don't have an audio player installed:
# For Ubuntu/Debian (PulseAudio)
sudo apt-get install pulseaudio-utils
# For ALSA
sudo apt-get install alsa-utils
# For FFmpeg
sudo apt-get install ffmpeg
Packaging the Extension
To package and install the extension:
Install vsce (VS Code Extension Manager):
npm install -g @vscode/vsce
Package the extension:
vsce package
Install the .vsix file:
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Click the "..." menu → "Install from VSIX"
- Select the generated
.vsix file
Publishing (Optional)
To publish to the VS Code Marketplace:
- Create a publisher account at https://marketplace.visualstudio.com/
- Update
publisher in package.json
- Run:
vsce publish
How It Works
- The extension monitors terminal command execution using VS Code's
onDidEndTerminalShellExecution event.
- When a command finishes, it checks the exit code.
- If the exit code is non-zero (indicating an error), it plays the configured sound file and briefly flashes the workspace status bar and title bar red before leaving them solid red.
- The sound is played using system audio players (platform-specific).
- The visual colors are automatically restored to normal immediately upon the next successful command (exit code 0).
Troubleshooting
Sound not playing?
- Check the sound file exists: Make sure
sounds/alert.mp3 exists
- Test the sound: Use the "Alert On Error: Test Sound" command
- Check audio player: Ensure you have a compatible audio player installed (see requirements)
- Check system volume: Make sure your system volume is not muted
- Check extension logs: Open Output panel → select "Alert On Error"
Getting false positives?
The extension responds when a terminal command exits with a non-zero code. If a command intentionally returns a non-zero code, it will trigger the sound.
Sound too loud/quiet?
Adjust the alertOnError.volume setting (0.0 to 1.0).
Development
Project Structure
Alert extension/
├── extension.js # Main extension code
├── package.json # Extension manifest
├── sounds/
│ ├── alert.mp3 # Your sound file
│ └── README.txt # Instructions
└── README.md # This file
Testing
- Open the extension folder in VS Code
- Press
F5 to start debugging
- Test in the Extension Development Host window
License
MIT License - Feel free to use and modify!
Contributing
Contributions are welcome! Feel free to:
- Add new features
- Improve error detection
- Add support for more audio formats
- Report bugs or issues
Changelog
1.0.0
- Initial release
- Terminal error detection using exit codes
- Configurable custom sound file
- Volume control
- Toggle command
- Test sound command
Made with ❤️ for developers who want audible error notifications!