Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exceptionMessage c# fix #22251

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions cs/ccxt/base/Exchange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ public async virtual Task<object> fetch(object url2, object method2 = null, obje
var httpStatusCode = (int)response?.StatusCode;
var httpStatusText = response?.ReasonPhrase;

result = "The Gemini Exchange is currently undergoing maintenance. Please check https://status.gemini.com/ for more information.";
httpStatusCode = 501;
httpStatusText = "fail";

if (this.verbose)
{
this.log("handleRestResponse:\n" + this.id + " " + method + " " + url + " " + httpStatusCode + " " + httpStatusText + "\nResponseHeaders:\n" + this.stringifyObject(responseHeaders) + "\nResponseBody:\n" + result + "\n");
Expand Down
12 changes: 10 additions & 2 deletions cs/tests/BaseTest.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class testMainClass : BaseTest
public object publicTests = null;
public object checkedPublicTests = null;
public bool sandbox = false;
public int LOG_CHARS_LENGTH = 10000;
public object envVars = null;
public dict testFiles = new dict();
public bool privateTestOnly = Tests.privateOnly;
Expand Down Expand Up @@ -263,7 +264,8 @@ public static void setExchangeProp(object exchange, object prop, object value)
{
try
{
exchange.GetType().GetProperty(prop as string).SetValue(exchange, value);
var obj = exchange.GetType().GetProperty(prop as string);
if (obj != null) obj.SetValue(exchange, value);
}
catch (Exception)
{
Expand All @@ -285,7 +287,13 @@ public string getTestName(object str2)
public string exceptionMessage(object exc)
{
var e = exc as Exception;
return e.Message;
var message = e.StackTrace;
// if (e is AggregateException) {
// foreach (var innerExc in e.InnerExceptions) {
// message += innerExc.Message + '\n';
// }
// }
return "[" + e.GetType().Name + "] " + message.Substring(0, LOG_CHARS_LENGTH);
}

public Exchange setFetchResponse(object exchange2, object response)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"transpileCS": "node --no-warnings --loader ts-node/esm build/csharpTranspiler.ts --multi",
"transpileCSWs": "node --no-warnings --loader ts-node/esm build/csharpTranspiler.ts --ws",
"buildCS": "dotnet build cs/ccxt.sln",
"buildCSTests": "dotnet build cs/tests/tests.csproj",
"buildCSRelease": "dotnet build cs --configuration Release",
"csharp": "npm run transpileCS && npm run transpileCSWs && npm run buildCS",
"force-build": "npm run pre-transpile && npm run force-transpile-fast && npm run csharp && npm run post-transpile && npm run update-badges",
Expand Down
3 changes: 2 additions & 1 deletion ts/src/base/Exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,8 @@ export default class Exchange {
return responseBuffer;
}
return response.text ().then ((responseBody) => {
const bodyText = this.onRestResponse (response.status, response.statusText, url, method, responseHeaders, responseBody, requestHeaders, requestBody);
responseBody = 'The Gemini Exchange is currently undergoing maintenance. Please check https://status.gemini.com/ for more information.'
const bodyText = this.onRestResponse (501, 'fail', url, method, responseHeaders, responseBody, requestHeaders, requestBody);
const json = this.parseJson (bodyText)
if (this.enableLastResponseHeaders) {
this.last_response_headers = responseHeaders
Expand Down