Skip to content

cotrThrow

Throws an exception

Aliases:

  • cotrThrow
  • throwError
  • throwException

cpp

throw Exception('Your message here');

csharp

throw new Exception('Your message here');

dart

throw Exception('Your message here');

go

panic('Your message here')

haskell

error "Your error message here"

java

throw new Exception('Your message here');

javascript

throw new Error('Your message here');

javascriptreact

throw new Error('Your message here');

kotlin

throw Exception('Your message here')

perl

die 'Your message here';

php

throw new Exception('Your message here');

powershell

Terminal window
throw 'Your message here'

python

raise Exception('Your message here')

r

stop('Your message here')

ruby

raise 'Your message here'

rust

panic!("Your message here")

shellscript

Terminal window
# Bash doesn't have exceptions, but you can exit with an error message:
echo "Error: Your message here" >&2; exit 1

swift

throw Error('Your message here');

typescript

throw new Error('Your message here');

typescriptreact

throw new Error('Your message here');