WithError() public static method

public static WithError ( HttpStatusCode code ) : Spark.Engine.Core.FhirResponse
code HttpStatusCode
return Spark.Engine.Core.FhirResponse
Exemplo n.º 1
0
        public static FhirResponse Gone(Interaction entry)
        {
            var message = String.Format(
                "A {0} resource with id {1} existed, but was deleted on {2} (version {3}).",
                entry.Key.TypeName,
                entry.Key.ResourceId,
                entry.When,
                entry.Key.ToRelativeUri());

            return(Respond.WithError(HttpStatusCode.Gone, message));
        }
Exemplo n.º 2
0
 public static FhirResponse WithMeta(Interaction interaction)
 {
     if (interaction.Resource != null && interaction.Resource.Meta != null)
     {
         return(Respond.WithMeta(interaction.Resource.Meta));
     }
     else
     {
         return(Respond.WithError(HttpStatusCode.InternalServerError, "Could not retrieve meta. Meta was not present on the resource"));
     }
 }
Exemplo n.º 3
0
 public static FhirResponse NotFound(IKey key)
 {
     if (key.VersionId == null)
     {
         return(Respond.WithError(HttpStatusCode.NotFound, "No {0} resource with id {1} was found.", key.TypeName, key.ResourceId));
     }
     else
     {
         return(Respond.WithError(HttpStatusCode.NotFound, "There is no {0} resource with id {1}, or there is no version {2}", key.TypeName, key.ResourceId, key.VersionId));
     }
     // For security reasons (leakage): keep message in sync with Error.NotFound(key)
 }