lib/pg_conn.rb in pg_conn-0.15.1 vs lib/pg_conn.rb in pg_conn-0.16.0
- old
+ new
@@ -71,9 +71,12 @@
# otherwise nil. It is cleared at the beginning of a transaction so be sure
# to save it before you run any cleanup code that may initiate new
# transactions
attr_reader :error
+ # True if the transaction is in a error state
+ def error?() !@error.nil? end
+
# Tuple of error message, lineno, and charno of the error object where each
# element defaults to nil if not found
def err
@err ||=
if error&.message =~ /.*?ERROR:\s*(.*?)\n(?:.*?(\s*LINE\s+(\d+): ).*?\n(?:(\s+)\^\n)?)?/