19 using System.Collections.Generic;
40 var pythonException = exception as PythonException;
41 if (pythonException ==
null)
48 return base.CanInterpret(exception) &&
49 pythonException.Type.Name.Contains(
"KeyError", StringComparison.InvariantCultureIgnoreCase);
60 var pe = (PythonException)exception;
62 var key =
string.Empty;
63 if (pe.Message.Contains(
'[', StringComparison.InvariantCulture))
65 key = pe.Message.GetStringBetweenChars(
'[',
']');
67 else if (pe.Message.Contains(
'\'', StringComparison.InvariantCulture))
69 key = pe.Message.GetStringBetweenChars(
'\'',
'\'');
75 return new KeyNotFoundException(message, pe);