Beispiel #1
0
 // For testing exceptions, thrown by resolver down deep in the data tree
 public string GetNameOrThrow(IFieldContext context, OtherThing otherThing)
 {
     if (otherThing.Id == 5)
     {
         throw new Exception("Exception thrown by GetNameOrThrow.");
     }
     return(otherThing.Name);
 }
Beispiel #2
0
        public async Task <string> GetNameOrThrowAsync(IFieldContext context, OtherThing otherThing)
        {
            if (otherThing.Id == 5) // child #2 of ApiThing #1,
            {
                throw new Exception("Exception thrown by GetNameOrThrowAsync.");
            }
            await Task.CompletedTask;

            return(otherThing.Name);
        }