17 using System.Runtime.CompilerServices;
26 public static partial class Messages
33 [MethodImpl(MethodImplOptions.AggressiveInlining)]
34 public static string DynamicLinkLibraryNotFound(
string dllName,
string platform)
36 return $
"The dynamic-link library for {dllName} could not be found. " +
37 "Please visit https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/readme.md for instructions " +
38 $
"on how to enable python support in {platform}";
47 public static string InvalidTokenExpectedSubstring =
"invalid token";
49 public static string NotPermittedExpectedSubstring =
"are not permitted;";
51 [MethodImpl(MethodImplOptions.AggressiveInlining)]
52 public static string InterpretException(PythonException exception)
54 var message =
"Trying to include an invalid token/character in any statement throws a SyntaxError exception. " +
55 "To prevent the exception, ensure no invalid token are mistakenly included (e.g: leading zero).";
56 var errorLine = exception.Message.GetStringBetweenChars(
'(',
')');
58 return $
"{message}{Environment.NewLine} in {errorLine}{Environment.NewLine}";
67 [MethodImpl(MethodImplOptions.AggressiveInlining)]
68 public static string KeyNotFoundInCollection(
string key)
70 return "Trying to retrieve an element from a collection using a key that does not exist " +
71 $
@"in that collection throws a KeyError exception. To prevent the exception, ensure that the {
72 key} key exist in the collection and/or that collection is not empty.";
81 public static string NoMethodMatchExpectedSubstring =
"No method match";
83 [MethodImpl(MethodImplOptions.AggressiveInlining)]
84 public static string AttemptedToAccessMethodThatDoesNotExist(
string methodName)
86 return "Trying to dynamically access a method that does not exist throws a TypeError exception. " +
87 $
@"To prevent the exception, ensure each parameter type matches those required by the {
88 methodName} method. Please checkout the API documentation.";
97 [MethodImpl(MethodImplOptions.AggressiveInlining)]
98 public static string ScheduledEventName(
string eventName)
100 return $
"In Scheduled Event '{eventName}',";
109 [MethodImpl(MethodImplOptions.AggressiveInlining)]
112 return $
"Loaded ExceptionInterpreter: {interpreter.GetType().Name}";
121 public static string UnsupportedOperandTypeExpectedSubstring =
"unsupported operand type";
123 [MethodImpl(MethodImplOptions.AggressiveInlining)]
124 public static string InvalidObjectTypesForOperation(
string types)
126 return $
@"Trying to perform a summation, subtraction, multiplication or division between {
127 types} objects throws a TypeError exception. To prevent the exception, ensure that both values share the same type.";