How to determine that caught LibGit2SharpException is the HTTP 401 error? - libgit2sharp

When I try to fetch changes (RepositoryExtensions.Fetch) using invalid credentials LibGit2Sharp throws LibGit2SharpException with the following message:
An error was raised by libgit2. Category = Tag (Error).
Request failed with status code: 401
Since there might be other errors is there any way to determine that the exception is in fact HTTP 401 error without parsing the message?

Unfortunately, I don't think it is currently possible to get more specific information from that exception. This is something that would be a useful addition. Would you want to open an issue on the LibGit2Sharp project for this? If not, I will create one shortly.

Related

i'm getting error 500 when i'm trying to perform a function in swagger CodGen

I'm trying to build an API and I'm using swagger editor, swagger gen and swagger UI. I have a YAML file from swagger editor, and I generated a python-flask server, I ran the server and it worked fine, the problem is on my page I have a few endpoints when I want to try the endpoint I just press try it now button on the page and press execute and this is the response I keep getting
(https://i.stack.imgur.com/vm0rH.png)
what the response should be
(https://i.stack.imgur.com/gKm9i.png)
till now I didn't perform any logic for it i'm just trying to print on the server response but i keep getting the same error message
when I figured it out it was because of an error on the controller function of that specific endpoint, and this is what I have tried to print but I keep getting the same error above, i know it's because of that endpoint function but I don't know what exactly
(https://i.stack.imgur.com/bMKU4.png)
and this what I'm getting on the terminal
[error on the terminal]
i even have tried this but same error
second try
any solutions? or why is this happening
Set a breakpoint in your code and debug your application step by step and you might find the reason of the error.

Discrepency with Jenkins Crumb value

I am using Postman API to create new job in Jenkins.Inside Postman UI,with GET request the Jenkins-crumb I am getting gives me proper output i.e.Status 200 Ok when passed into POST request.
But when I am hitting same URL(used in GET request) outside Postman UI, the crumb value that I get gives me "403 NO valid crumb included in request".
How we can solve this issue?
Mostly its due to the security constraints in Jenkins https://jenkins.io/doc/upgrade-guide/2.176/
To fix, you might use options specified in this answer https://stackoverflow.com/a/59261140/374133
I had same issue while using C#, and it got solved by using the same HttpClient for requesting crumb and triggering build. Got the idea from this answer : https://stackoverflow.com/a/63103522/374133

Server Error 404 is returned when trying to get an authorization code from live.com

We have two applications which use OAuth2 authentication to get access to Hotmail.
The first application works fine. But in the second application we have an error after entering login/password:
Server Error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
URLs and code used to show these URLs are identical in both application:
url = "https://login.live.com/oauth20_authorize.srf?response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&scope=wl.imap+wl.offline_access+wl.emails&client_id=REAL-CLIENT-ID"
self.browser.load(QUrl(url))
Unfortunately, I have no idea how can fix it. Can anyone help me with this?
It's weird but this issue was fixed by adding:
QCoreApplication.setOrganizationName("anOrganizationName")
QCoreApplication.setOrganizationDomain("anOrganizationDomain")
QCoreApplication.setApplicationName("anApplicationName")
Perhaps it would be enough one of these string to fix issue. I didn't check it.

Unexpected error on ACDOAuthSigner connection

Has anyone gotten this exception before? If so, what does it mean? I get this occasionally when trying to save a new account to an ACAccountStore. So far I haven't been able to find any information as to what the problem is.
'Unexpected error on ACDOAuthSigner connection: Error Domain=XPCObjectsErrorDomain Code=2'

Hacking attempts yields "The controller for path '...' was not found or does not implement IController"

We get notified of every error on our MVC2 web application. And we've receiving errors for controller path not found for files we know don't exist and therefore we believe are hacking attempts
System.Web.HttpException: The controller for path '/zencart/install.txt' was not found or does not implement IController.
What's the best way to avoid those errors to come up when people try to hack our website by trying to request files such as install.txt?
Thanks...
You are already preventing them: a 404 error is sent instead of a the real file.

Resources