Improved error handling when QBW file does not exist or SDK not installed. BOD-142

This commit is contained in:
Patrick Fic
2020-06-04 10:14:55 -07:00
parent b9573b38f0
commit e8c58dab2f
2 changed files with 54 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -25,6 +26,10 @@ namespace BodyshopPartner.Utils
public static void ConnectToQuickBooks()
{
if(String.IsNullOrWhiteSpace(Properties.Settings.Default.QuickBooksFilePath) || !File.Exists(Properties.Settings.Default.QuickBooksFilePath))
{
throw new Exception("The QuickBooks file specified does not exist.");
}
try
{
logger.Debug("Attempting to connect to QuickBooks...");
@@ -58,6 +63,11 @@ namespace BodyshopPartner.Utils
catch (Exception ex)
{
logger.Error(ex);
if(ex.Message.Contains("80040154 Class not registered"))
{
logger.Error("QuickBooks Request Processor not registered. Is QuickBooks installed on this computer?");
throw new Exception("QuickBooks Request Processor not registered. Is QuickBooks installed on this computer?");
}
}
}