use fail to throw errors, use raise to rethrow errors