Skip to content

Commit c930e80

Browse files
committed
Simplify exception handling
1 parent 72bf163 commit c930e80

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

ExchangeSharp/API/Exchanges/_Base/ExchangeAPI.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -447,20 +447,13 @@ public virtual string CurrenciesToExchangeMarketSymbol(string baseCurrency, stri
447447
// no separator logic...
448448
if (string.IsNullOrWhiteSpace(MarketSymbolSeparator))
449449
{
450-
try
451-
{
452-
// we must look it up via metadata, most often this call will be cached and fast
453-
ExchangeMarket marketSymbolMetadata = await GetExchangeMarketFromCacheAsync(marketSymbol);
454-
if (marketSymbolMetadata == null)
455-
{
456-
throw new InvalidDataException($"No market symbol metadata returned or unable to find symbol metadata for {marketSymbol}");
457-
}
458-
return (marketSymbolMetadata.BaseCurrency, marketSymbolMetadata.QuoteCurrency);
459-
}
460-
catch (Exception e)
450+
// we must look it up via metadata, most often this call will be cached and fast
451+
ExchangeMarket marketSymbolMetadata = await GetExchangeMarketFromCacheAsync(marketSymbol);
452+
if (marketSymbolMetadata == null)
461453
{
462-
throw new InvalidOperationException($"Failed to retrieve symbol metadata for exchange {Name}.", e);
454+
throw new InvalidDataException($"No market symbol metadata returned or unable to find symbol metadata for {marketSymbol}");
463455
}
456+
return (marketSymbolMetadata.BaseCurrency, marketSymbolMetadata.QuoteCurrency);
464457
}
465458

466459
// default behavior with separator

ExchangeSharpConsole/ExchangeSharpConsole_Main.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ private static Dictionary<string, string> ParseCommandLine(string[] args)
5656
return dict;
5757
}
5858

59-
private static void TestMethod()
60-
{
61-
}
62-
6359
/// <summary>
6460
/// Console app main method
6561
/// </summary>
@@ -81,7 +77,6 @@ public static async Task<int> ConsoleMain(string[] args)
8177
{
8278
// swap out to external web socket implementation for older Windows pre 8.1
8379
// ExchangeSharp.ClientWebSocket.RegisterWebSocketCreator(() => new ExchangeSharpConsole.WebSocket4NetClientWebSocket());
84-
// TestMethod(); return 0; // uncomment for ad-hoc code testing
8580
Logger.Info("ExchangeSharp console started.");
8681
Dictionary<string, string> argsDictionary = ParseCommandLine(args);
8782
if (argsDictionary.Count == 0 || argsDictionary.ContainsKey("help"))

0 commit comments

Comments
 (0)