All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.lang.parser.exceptions.ErrantGosuClassException Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
/*
 * Copyright 2014 Guidewire Software, Inc.
 */

package gw.lang.parser.exceptions;

import gw.lang.reflect.TypeSystem;
import gw.lang.reflect.gs.IGosuClass;

public class ErrantGosuClassException extends RuntimeException
{
  private IGosuClass _gsClass;

  public ErrantGosuClassException( IGosuClass gsClass )
  {
    _gsClass = gsClass;
  }

  @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
  public String getMessage()
  {
    ParseResultsException resultsException = _gsClass.getParseResultsException();
    if( resultsException == null )
    {
      TypeSystem.lock();
      try
      {
        _gsClass.isValid();
        resultsException = _gsClass.getParseResultsException();
      }
      finally
      {
        TypeSystem.unlock();
      }
    }
    String strResultsMsg = resultsException == null ? "" : resultsException.getMessage();
    return "GosuClass " + _gsClass.getName() +
           " has errors, and cannot be used at runtime.\n"
           + strResultsMsg;
  }

  public IGosuClass getGsClass()
  {
    return _gsClass;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy