anniekvandijk / toxicplants Goto Github PK
View Code? Open in Web Editor NEWApi with http endpoint for matching phot's of plants with list of Toxic plants for a specific animal.
License: MIT License
Api with http endpoint for matching phot's of plants with list of Toxic plants for a specific animal.
License: MIT License
Must be solved as soon as the bug is fixed.
Remove:
- name: Add 3.1 bug
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
From:
.github/workflows/dotnet.yml
On error, alter the response status and message
Azure/azure-functions-dotnet-worker#530 (comment)
[2021-11-14T10:17:29.412Z] One or more errors occurred. (Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)
[2021-11-14T10:17:29.416Z] Result: One or more errors occurred. (Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)
Exception: System.AggregateException: One or more errors occurred. (Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)
[2021-11-14T10:17:29.417Z] ---> System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[2021-11-14T10:17:29.418Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Extensions.OpenApiHttpRequestDataExtensions.Queries(HttpRequestData req)
[2021-11-14T10:17:29.420Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.HttpRequestObject..ctor(HttpRequestData req)
[2021-11-14T10:17:29.421Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Functions.OpenApiTriggerFunction.RenderSwaggerUI(HttpRequestData req, FunctionContext ctx)
[2021-11-14T10:17:29.421Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.DefaultOpenApiHttpTrigger.RenderSwaggerUI(HttpRequestData req, FunctionContext ctx)
[2021-11-14T10:17:29.422Z] --- End of inner exception stack trace ---
[2021-11-14T10:17:29.423Z] at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) [2021-11-14T10:17:29.423Z] at System.Threading.Tasks.Task
1.get_Result()
[2021-11-14T10:17:29.424Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker2.<>c.<InvokeAsync>b__6_0(Task
1 t) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32
[2021-11-14T10:17:29.426Z] at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() [2021-11-14T10:17:29.427Z] at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) [2021-11-14T10:17:29.428Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) [2021-11-14T10:17:29.429Z] --- End of stack trace from previous location --- [2021-11-14T10:17:29.430Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) [2021-11-14T10:17:29.431Z] at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [2021-11-14T10:17:29.431Z] --- End of stack trace from previous location --- [2021-11-14T10:17:29.432Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 44 [2021-11-14T10:17:29.436Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 [2021-11-14T10:17:29.437Z] at Function.MiddleWare.ExceptionHandler.ExceptionHandlerMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\Repositories\Persoonlijk\Github\Net\ToxicPlants\Function\MiddleWare\ExceptionHandler\ExceptionHandlerMiddleWare.cs:line 20 Stack: at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification)
[2021-11-14T10:17:29.439Z] at System.Threading.Tasks.Task1.get_Result() [2021-11-14T10:17:29.439Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker
2.<>c.b__6_0(Task1 t) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32 [2021-11-14T10:17:29.441Z] at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.InnerInvoke()
[2021-11-14T10:17:29.444Z] at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
[2021-11-14T10:17:29.446Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
[2021-11-14T10:17:29.447Z] --- End of stack trace from previous location ---
[2021-11-14T10:17:29.447Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
[2021-11-14T10:17:29.448Z] at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[2021-11-14T10:17:29.452Z] --- End of stack trace from previous location ---
[2021-11-14T10:17:29.452Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 44
[2021-11-14T10:17:29.453Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2021-11-14T10:17:29.454Z] at Function.MiddleWare.ExceptionHandler.ExceptionHandlerMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\Repositories\Persoonlijk\Github\Net\ToxicPlants\Function\MiddleWare\ExceptionHandler\ExceptionHandlerMiddleWare.cs:line 20.
s.AddControllers().AddJsonOptions(x =>
{
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
x.JsonSerializerOptions.IgnoreNullValues = true;
});
Response still contains int and null
When something goes wrong I want to stop the function execution and give an response. But
As long as this is not possible, I use the ExceptionHandlingMiddlware to stop the execution. But it is an anti-patern to use exceptions for this.
For now I made a seperate class ProgramError to make a diffrence between a exception
foreach (var animal in animals)
{
if (Enum.TryParse(animal.Data, true, out Animal animalEnum))
{
_animalRepository.Add(animalEnum);
}
else
{
ProgramError.CreateProgramError(HttpStatusCode.BadRequest, "Animal not supported");
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.