die "Invalid argument $x";
enum {
E_OK,
E_OUT_OF_RANGE
};
int square(int x, int *result) {
if (x > 1073741823) {
return E_OUT_OF_RANGE;
}
*result = x*x;
return E_OK;
}
throw domain_error("oops!");
throw new ArgumentException(nameof(×));
throw new Exception("invalid value for x (%s) in '%s'".format(x, __PRETTY_FUNCTION__));
void foo(int x)
in
{
assert(x != 0, "wrong value for x");
}
body
{
// function
}
if (x > largest_value) error stop "Illegal value in function."
return nil, fmt.Errorf("invalid value for x: %v", x)
throw new IllegalArgumentException("Invalid value for x: $x")
sqrt' :: Int -> Either String Int
sqrt' x | x < 0 = Left "Invalid argument"
sqrt' x = Right (sqrt x)
throw new Error('x is invalid');
void f(int x) {
Objects.checkIndex(x, 123);
}
<T> void f(T x) throws Exception {
if (x != value) throw new Exception();
}
<T> void f(T x) {
Objects.requireNonNull(x);
}
throw new IllegalArgumentException("Invalid value for x:" + x);
error("Invalid argument x")
return nil, "Invalid argument x"
throw new \InvalidArgumentException($x . ' is invalid.');
Raise EInvalidArgument.CreatFmt('Invalid value: %d',[x]);
raise ValueError("x is invalid")
raise ArgumentError, "invalid value #{x}."
enum CustomError { InvalidAnswer }
fn do_stuff(x: i32) -> Result<i32, CustomError> {
if x != 42 {
Err(CustomError::InvalidAnswer)
} else {
Ok(x)
}
}