public void ReportError(AlexaErrorTypes type, string message) { if (Response.GetType() != typeof(ControlResponse)) { return; } ResponseContext = null; ResponseEvent.header.name = "ErrorResponse"; ResponseEvent.payload = new AlexaErrorResponsePayload(type, message); EventLogEntryType errorType; switch (type) { case AlexaErrorTypes.INTERNAL_ERROR: errorType = EventLogEntryType.Error; break; case AlexaErrorTypes.INVALID_VALUE: case AlexaErrorTypes.VALUE_OUT_OF_RANGE: case AlexaErrorTypes.NO_SUCH_ENDPOINT: errorType = EventLogEntryType.Warning; break; default: errorType = EventLogEntryType.Information; break; } PremiseServer.NotifyErrorAsync(errorType, $"Controller Error: Controller:{RequestHeader.@namespace} ErrorType:{type} ErrorMessage:{message}", 200).GetAwaiter().GetResult(); }
public AlexaErrorResponsePayload(AlexaErrorTypes errType, string errMessage) { type = errType.ToString(); message = errMessage; }