internal static RuntimeException NewInterpreterExceptionWithInnerException( object targetObject, Type exceptionType, Token errToken, string resourceIdAndErrorId, Exception innerException, params object[] args) { if (string.IsNullOrEmpty(resourceIdAndErrorId)) { throw InterpreterError.tracer.NewArgumentException(nameof(resourceIdAndErrorId)); } RuntimeException runtimeException; try { string message = args == null || args.Length == 0 ? ResourceManagerCache.GetResourceString("Parser", resourceIdAndErrorId) : ResourceManagerCache.FormatResourceString("Parser", resourceIdAndErrorId, args); runtimeException = !string.IsNullOrEmpty(message) ? InterpreterError.NewInterpreterExceptionByMessage(exceptionType, errToken, message, resourceIdAndErrorId, innerException) : InterpreterError.NewBackupInterpreterException(exceptionType, errToken, resourceIdAndErrorId, (Exception)null); } catch (InvalidOperationException ex) { runtimeException = InterpreterError.NewBackupInterpreterException(exceptionType, errToken, resourceIdAndErrorId, (Exception)ex); } catch (MissingManifestResourceException ex) { runtimeException = InterpreterError.NewBackupInterpreterException(exceptionType, errToken, resourceIdAndErrorId, (Exception)ex); } catch (FormatException ex) { runtimeException = InterpreterError.NewBackupInterpreterException(exceptionType, errToken, resourceIdAndErrorId, (Exception)ex); } runtimeException.SetTargetObject(targetObject); return(runtimeException); }