private static void FormatScriptError(ProcedureCollection procedures, RESPError error) { var pos = error.Message.IndexOf("Error running script (call to "); if (pos != -1 && error.Message.Length >= 72) { var scriptId = error.Message.Substring(30, 42); var sha1 = scriptId.Substring(2); ProcedureDefinition script; if (procedures.TryGetByDigest(sha1, out script)) { error.SetMessage(error.Message.Replace(scriptId, String.Format("{0} [sha1: {1}]", script.Name, sha1))); } } }
private RESPCommand GenerateLoadCommand(String digest) { ProcedureDefinition procedure; if (!_procedures.TryGetByDigest(digest, out procedure)) { throw new RedisClientParsingException("Script with digest '" + digest + "' does not exist."); } var array = new RESPCommand(new RESPCommandLiteral("SCRIPT"), false); array.Add(new RESPCommandLiteral("load")); array.Add(new RESPCommandLiteral(procedure.Body)); return(array); }