Can PgSqlException and NpgsqlException be used interchangeably?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DeafSmith
    New Member
    • Aug 2015
    • 6

    #1

    Can PgSqlException and NpgsqlException be used interchangeably?

    I have some sophisticated error trapping using NpgsqlException .

    But many of my SQL reads are in Postgresql and use PgSqlException for error trapping.

    So, instead of using:
    Code:
    catch (PgSqlException ex)
                { MessageBox.Show(ex.ToString()); }
    I want to use
    Code:
    catch (NpgsqlException ex)
         {
          string errorx = UsefulTools.error_list(ex.Code);
          MessageBox.Show("Error in reading table for reason " + errorx + "\n");
          }
    And in my 'UsefulTools.cs ' I have a rather long list of error codes and what they mean.

    So, will that work? Can I use NpgsqlException instead of PgSqlException?

    Thanks!
    Last edited by Rabbit; Nov 4 '15, 07:59 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...