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

org.snapscript.core.error.ExternalErrorHandler Maven / Gradle / Ivy

package org.snapscript.core.error;

import org.snapscript.core.result.Result;
import org.snapscript.core.scope.Scope;

public class ExternalErrorHandler {

   public ExternalErrorHandler() {
      super();
   }

   public Result handleError(Scope scope, Object cause) throws Exception {
      if(Exception.class.isInstance(cause)) {
         throw (Exception)cause;
      }
      if(Throwable.class.isInstance(cause)) {
         throw new InternalException((Throwable)cause);
      }
      throw new InternalException(String.valueOf(cause));
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy