dynamic abort([int statusCode = 500, body = 'Something went wrong'])

Source

abort([int statusCode = 500, body = 'Something went wrong']) {
  throw new HttpException(statusCode, body);
}