create a new RemoteExceptionType from a given errortype
428281
def _newRemoteException(ErrorType):
    ''''''
    RemoteErrorBaseType = _RemoteExceptionMeta('', (ErrorType,), {})
    class RemoteException(RemoteErrorBaseType):
        BaseExceptionType = ErrorType

        def __init__(self, thrownError, tracebackString):
            self.thrownError = thrownError
            self.tracebackString = tracebackString
            RemoteErrorBaseType.__init__(self, *thrownError.args)

        loadError = staticmethod(_loadError)

        def __str__(self):
            return '\n%s\n%s' % (self.tracebackString, self.thrownError)

        def __reduce__(self):
            args = (ErrorType, self.thrownError, self.tracebackString)
            return self.loadError, args
    RemoteException.__name__ = 'Remote' + ErrorType.__name__
    return RemoteException
703483
public static Class<?>[] getCheckedExceptions(Method method,
                                                  boolean isRmiRemote,
                                                  DeploymentTarget target,
                                                  EJBWrapperType wrapperType,
                                                  boolean declaredUncheckedAreSystemExceptions,
                                                  boolean declaredRemoteAreApplicationExceptions)
                    throws EJBConfigurationException
    {
        boolean throwsRemoteException = false;
        Class<?>[] exceptions = method.getExceptionTypes();
        int numExceptions = exceptions.length;
        ArrayList<Class<?>> checkedExceptions = new ArrayList<Class<?>>(numExceptions);

        for (Class<?> exception : exceptions)
        {
            // --------------------------------------------------------------------
            // Only Remote interfaces that implement java.rmi.Remote may throw
            // java.rmi.RemoteException.
            // --------------------------------------------------------------------
            if (exception == RemoteException.class)
            {
                if (!isRmiRemote)
                {
                    // This is only a warning since the spec says 'should' and not
                    // must... but let them know it is a bad idea.            d450525
                    Tr.warning(tc, "JIT_INVALID_THROW_REMOTE_CNTR5101W",
                               new Object[] { method.getName(),
                                             method.getDeclaringClass().getName() });
                }
                throwsRemoteException = true;
                continue; // skip - remote allowed, but not 'checked' exception
            }

            // --------------------------------------------------------------------
            // Application exceptions must not subclass RemoteException.
            // --------------------------------------------------------------------
            else if ((RemoteException.class).isAssignableFrom(exception))
            {
                // Tolerate for stubs since the server EJB might allow.    RTC116527
                if (target == DeploymentTarget.STUB)
                {
                    // Keep the exception.
                }
                // For tie/wrapper, only allow if a custom property is specified and
                // only then for business interfaces.                      RTC116527
                else if (declaredRemoteAreApplicationExceptions &&
                         (wrapperType == null ||
                          wrapperType == EJBWrapperType.BUSINESS_REMOTE ||
                         wrapperType == EJBWrapperType.BUSINESS_LOCAL))
                {
                    // Keep the exception.
                }
                else
                {
                    // Log the error and throw meaningful exception.             d450525
                    String className = method.getDeclaringClass().getName();
                    Tr.error(tc, "JIT_INVALID_SUBCLASS_REMOTE_EX_CNTR5102E",
                             new Object[] { exception.getName(),
                                           method.getName(),
                                           className });
                    throw new EJBConfigurationException("Application exception " + exception.getName() +
                                                        " defined on method " + method.getName() + " of interface " +
                                                        className + " must not subclass java.rmi.RemoteException.");
                }
            }

            // --------------------------------------------------------------------
            // Per the spec, unchecked exceptions (RuntimeException and Error)
            // should not be considered application.  They are also ignored by
            // rmic when generating stubs and ties.                         d660332
            // --------------------------------------------------------------------
            else if (RuntimeException.class.isAssignableFrom(exception) ||
                     Error.class.isAssignableFrom(exception)) // 651626.1
            {
                // For stubs, we keep unchecked exceptions so that they can handle
                // IDL strings from ties generated by previous releases where
                // unchecked exceptions were not filtered.
                if (target == DeploymentTarget.STUB)
                {
                    // Keep the exception.
                }
                // For wrappers, we keep unchecked exceptions if the user has
                // indicated that unchecked exceptions should be considered
                // application exceptions.
                else if (target == DeploymentTarget.WRAPPER &&
                         !declaredUncheckedAreSystemExceptions)
                {
                    // Keep the exception.
                }
                else
                {
                    // Remove the exception.
                    continue;
                }
            }
            else if (!Exception.class.isAssignableFrom(exception)) // d608631
            {
                String className = method.getDeclaringClass().getName();
                Tr.error(tc, "JIT_INVALID_NOT_EXCEPTION_SUBCLASS_CNTR5107E",
                         new Object[] { exception.getName(),
                                       method.getName(),
                                       className });

                throw new EJBConfigurationException("The " + exception.getName() +
                                                    " application exception defined on the " + method.getName() +
                                                    " method of the " + className +
                                                    " class must be defined as a subclass of the java.lang.Exception class.");
            }

            // --------------------------------------------------------------------
            // Exception is a valid application exception... but it cannot just
            // be added to the end of the list, since it may be a subclass of
            // other exceptions on the throws clause, which could result in
            // 'unreachable' code when adding 'catch' blocks.
            //
            // Instead, do one of two things:
            // 1 - Remove any exceptions that are subclasses of other exceptions.
            //     This is useful when a catch block is being added for each
            //     checked exception, and the processing done in the parent
            //     exception would be the same as any subclasses.  For example,
            //     in a generated wrapper, catch blocks for all checked exceptions
            //     just call 'setCheckedException'... so no need to duplicate that
            //     for all subclass exceptions.
            // 2 - Insert the current exception ahead of the first exception
            //     already in the list that is a parent.  This eliminates the
            //     'unreachable' code problem, and also ends up with the
            //     exceptions in the original order if there are no subclasses.
            // --------------------------------------------------------------------

            if (target == DeploymentTarget.WRAPPER) // d660332
            {
                // -----------------------------------------------------------------
                // Remove any already added exceptions that are subclasses of the
                // current exception.  Ignore the current exception if a superclass
                // has already been added.                                 RTC116527
                // -----------------------------------------------------------------
                boolean add = true;
                for (Iterator<Class<?>> iter = checkedExceptions.iterator(); iter.hasNext();)
                {
                    Class<?> checkedEx = iter.next();
                    if (exception.isAssignableFrom(checkedEx))
                    {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                            Tr.debug(tc, "getCheckedExceptions: ignoring " +
                                         checkedEx.getName() + ", subclass of " +
                                         exception.getName());
                        iter.remove();
                    }
                    else if (checkedEx.isAssignableFrom(exception))
                    {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                            Tr.debug(tc, "getCheckedExceptions: ignoring " +
                                         exception.getName() + ", subclass of " +
                                         checkedEx.getName());
                        add = false;
                        break;
                    }
                }

                if (add)
                {
                    checkedExceptions.add(exception);
                }
            }
            else
            {
                // -----------------------------------------------------------------
                // Sort exceptions, so that subclasses are ahead of parents
                // -----------------------------------------------------------------
                int j;
                int numChecked = checkedExceptions.size();
                for (j = 0; j < numChecked; ++j)
                {
                    Class<?> checkedEx = checkedExceptions.get(j);
                    if (checkedEx.isAssignableFrom(exception))
                        break;
                }

                checkedExceptions.add(j, exception);
            }
        }

        // -----------------------------------------------------------------------
        // After all exceptions have been processed, make sure that a
        // RemoteException was present if the interface implements java.rmi.Remote
        // -----------------------------------------------------------------------
        if (isRmiRemote && !throwsRemoteException)
        {
            // Log the error and throw meaningful exception.                d450525
            String className = method.getDeclaringClass().getName();
            Tr.error(tc, "JIT_MISSING_REMOTE_EX_CNTR5104E",
                     new Object[] { method.getName(), className });
            throw new EJBConfigurationException("Method " + method.getName() + " of interface " + className +
                                                " must throw java.rmi.RemoteException");
        }

        return checkedExceptions.toArray(new Class[checkedExceptions.size()]);
    }
413663
def _xmlTextReaderErrorFunc(xxx_todo_changeme,msg,severity,locator):
    """"""
    (f,arg) = xxx_todo_changeme
    return f(arg,msg,severity,xmlTextReaderLocator(locator))
738345
public static JSError make(DiagnosticType type, String... arguments) {
    return new JSError(null, null, -1, -1, type, null, arguments);
  }
874155
public String renderExceptionType(E event) {
        Exception exception = event.getException();

        if (exception instanceof EsHadoopRemoteException) {
            EsHadoopRemoteException remoteException = ((EsHadoopRemoteException) exception);
            return remoteException.getType();
        } else {
            String classText = exception.getClass().getSimpleName();
            StringBuilder builder = new StringBuilder();
            boolean first = true;
            for (char c : classText.toCharArray()) {
                if (Character.isUpperCase(c)) {
                    if (first) {
                        first = false;
                    } else {
                        builder.append("_");
                    }
                    builder.append(Character.toLowerCase(c));
                } else {
                    builder.append(c);
                }
            }
            return builder.toString();
        }
    }
1163492
def fromimportunreg(
        cls, bundle, cid, rsid, import_ref, exception, endpoint
    ):
        # type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ImportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
        
        return RemoteServiceAdminEvent(
            typ=RemoteServiceAdminEvent.IMPORT_UNREGISTRATION,
            bundle=bundle,
            cid=cid,
            rsid=rsid,
            import_ref=import_ref,
            exception=exception,
            endpoint=endpoint,
        )
541535
private String createError(String errorMsg, Throwable t) {

        StringBuffer msg = new StringBuffer();
        msg.append(errorMsg);
        msg.append("\n");
        msg.append(t.getMessage());
        msg.append("\n");
        msg.append(CmsException.getStackTraceAsString(t));

        return createError(msg.toString());
    }
692293
def fromimporterror(cls, bundle, importerid, rsid, exception, endpoint):
        # type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
        
        return RemoteServiceAdminEvent(
            RemoteServiceAdminEvent.IMPORT_ERROR,
            bundle,
            importerid,
            rsid,
            None,
            None,
            exception,
            endpoint,
        )
1354577
private Throwable mapException(EJSDeployedSupport s, RemoteException ex) //d135584
    {
        try
        {
            if (ex instanceof CSIException) {
                CSIException csiex = (CSIException) ex;
                return mapCSIException(s, csiex);
            }
            else if (ex.detail instanceof CSIException)
            {
                CSIException csiex = (CSIException) ex.detail; //d177787
                return mapCSIException(s, csiex);
            }
            else if (ex instanceof CreateFailureException)
            {
                // For consistency, just map/return the CreateFailureException
                // even if it contains an EJBException, as in most cases the
                // EJBException would just be wrapped in a plain RemoteException,
                // which CreateFailureException already is.                 d187050
                // Since this is already a RemoteException, it only needs to be
                // "mapped" if the method request is throught the ORB.       d228774
                if (!s.ivWrapper.ivInterface.ivORB)
                {
                    return ex;
                }

                return getOrbUtils().mapException(ex);
            }
            else if (ex instanceof BeanNotReentrantException &&
                     (s.ivWrapper.ivInterface == BUSINESS_RMI_REMOTE ||
                     s.ivWrapper.ivInterface == SERVICE_ENDPOINT)) // d350987
            {
                // EJB 3.0 has defined an exception for this purpose.      d366807.6
                // This mapping is only done for business interfaces to insure
                // compatibility with EJB 2.1 clients.                        396839
                BeanNotReentrantException bnre = (BeanNotReentrantException) ex;
                EJBException caex = bnre.isTimeout() ? new ConcurrentAccessTimeoutException(ex.getMessage()) // d653777.1
                : new ConcurrentAccessException(ex.getMessage());
                caex.setStackTrace(ex.getStackTrace());
                s.rootEx = caex;
                return mapEJBException(s, caex);
            }
            else if (ex.detail instanceof EJBException)
            {
                EJBException ejbex = (EJBException) ex.detail;
                return mapEJBException(s, ejbex);
            }
            else
            {
                // Since this is already a RemoteException, it only needs to be
                // "mapped" if the method request is throught the ORB.       d228774
                if (!s.ivWrapper.ivInterface.ivORB)
                {
                    return ex;
                }

                return getOrbUtils().mapException(ex);
            }
        } catch (CSIException e)
        {
            FFDCFilter.processException(e, CLASS_NAME + ".mapException", "119", this);
            Tr.warning(tc, "UNABLE_TO_MAP_EXCEPTION_CNTR0013W"
                       , new Object[] { ex, e }); //p111002.5
            return ex;
        }
    }
682515
function createError(name, message) {
        var e = new Error(message);
        e.name = name || 'DOMException';
        e.message = message;
        return e;
    }
189386
def extern_create_exception(self, context_handle, msg_ptr, msg_len):
    """"""
    c = self._ffi.from_handle(context_handle)
    msg = self.to_py_str(msg_ptr, msg_len)
    return c.to_value(Exception(msg))
1137940
private ErrorObjectWithJsonError createResponseError(String jsonRpc, Object id, JsonError errorObject) {
		ObjectNode response = mapper.createObjectNode();
		ObjectNode error = mapper.createObjectNode();
		error.put(ERROR_CODE, errorObject.code);
		error.put(ERROR_MESSAGE, errorObject.message);
		if (errorObject.data != null) {
			error.set(DATA, mapper.valueToTree(errorObject.data));
		}
		response.put(JSONRPC, jsonRpc);
		if (Integer.class.isInstance(id)) {
			response.put(ID, Integer.class.cast(id).intValue());
		} else if (Long.class.isInstance(id)) {
			response.put(ID, Long.class.cast(id).longValue());
		} else if (Float.class.isInstance(id)) {
			response.put(ID, Float.class.cast(id).floatValue());
		} else if (Double.class.isInstance(id)) {
			response.put(ID, Double.class.cast(id).doubleValue());
		} else if (BigDecimal.class.isInstance(id)) {
			response.put(ID, BigDecimal.class.cast(id));
		} else {
			response.put(ID, String.class.cast(id));
		}
		response.set(ERROR, error);
		return new ErrorObjectWithJsonError(response, errorObject);
	}
1090656
public void setExceptionType(String exceptionType) {
		if (exceptionType != null) {
			NullArgumentException.validateNotEmpty(exceptionType, "Error code");
		}
		this.exceptionType = exceptionType;
	}
221040
public static ErrorDescription create(ApplicationException ex) {
    	ErrorDescription description = new ErrorDescription();
    	description.setCategory(ex.getCategory());
    	description.setStatus(ex.getStatus());
    	description.setCode(ex.getCode());
    	description.setMessage(ex.getMessage());
    	description.setDetails(ex.getDetails());
    	description.setCorrelationId(ex.getCorrelationId());    	
    	description.setCause(ex.getCauseString());    	
    	description.setStackTrace(ex.getStackTraceString());    	
    	return description;
    }
70442
static DnsException translateAndThrow(RetryHelperException ex) {
    BaseServiceException.translate(ex);
    throw new DnsException(UNKNOWN_CODE, ex.getMessage(), ex.getCause());
  }
434111
function createError(code, type, desc) {
	errors[code] = function (msg, meta) {
		const err = new type(msg);

		if (desc) {
			if (!meta) {
				meta = {};
			}
			meta.desc = desc;
		}

		return Object.defineProperties(err, {
			code: {
				configurable: true,
				enumerable: true,
				writable: true,
				value: `ERR_${code}`
			},
			meta: {
				configurable: true,
				value: meta || undefined,
				writable: true
			}
		});
	};

	Object.defineProperties(errors[code], {
		name: {
			configurable: true,
			value: code,
			writable: true
		},
		toString: {
			configurable: true,
			value: function toString() {
				return `ERR_${code}`;
			},
			writable: true
		}
	});
}
324138
def fromexportupdate(cls, bundle, export_reg):
        # type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent
        
        exc = export_reg.get_exception()
        if exc:
            return RemoteServiceAdminEvent(
                RemoteServiceAdminEvent.EXPORT_ERROR,
                bundle,
                export_reg.get_export_container_id(),
                export_reg.get_remoteservice_id(),
                None,
                export_reg.get_export_reference(),
                None,
                export_reg.get_description(),
            )

        return RemoteServiceAdminEvent(
            RemoteServiceAdminEvent.EXPORT_UPDATE,
            bundle,
            export_reg.get_export_container_id(),
            export_reg.get_remoteservice_id(),
            None,
            export_reg.get_export_reference(),
            None,
            export_reg.get_description(),
        )