Possible to error if variable declaration cannot be resolved?

Is there a way to get serverless to error and quit execution if a variable declaration cannot be resolved rather than just issue a warning?

 Serverless Warning --------------------------------------

  A valid service attribute to satisfy the declaration 'self:custom.config.HEALTHCARE_PREMIUM_TABLE' could not be found.

If anyone is interested - here’s a hacky way I found to do this with a custom plugin …

import { isEmpty } from "lodash";

/**
 * Serverless Plugin which turns missing variable warnings into errors
 */
export class MissingVariableShouldErrorPlugin {
  constructor(serverless: any, _: any) {
    const variables = serverless.variables;
    const originalWarningMethod = variables.warnIfNotFound;

    const monkeyPatchWarnIfNotFoundMethod = function(
      this: any,
      variableString: any,
      valueToPopulate: any
    ) {
      originalWarningMethod.apply(this, [variableString, valueToPopulate]);
      if (
        valueToPopulate === null ||
        typeof valueToPopulate === "undefined" ||
        (typeof valueToPopulate === "object" && isEmpty(valueToPopulate))
      ) {
        throw Error(`Undefined variable: ${variableString}`);
      }
    };

    variables.warnIfNotFound = monkeyPatchWarnIfNotFoundMethod;
  }
}