Skip to content

Commit f13aa0c

Browse files
committed
Simplify error condition
1 parent 7bd7542 commit f13aa0c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/copy.jl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,9 @@ function execute(
128128
result_status = libpq_c.PQresultStatus(result)
129129

130130
if result_status != libpq_c.PGRES_COPY_OUT
131-
if !(result_status in (libpq_c.PGRES_BAD_RESPONSE, libpq_c.PGRES_FATAL_ERROR))
132-
level(LOGGER, Errors.JLResultError(
133-
"Expected PGRES_COPY_OUT after COPY query, got $result_status"
134-
))
135-
end
131+
level(LOGGER, Errors.JLResultError(
132+
"Expected PGRES_COPY_OUT after COPY query, got $result_status"
133+
))
136134
return result
137135
end
138136

@@ -148,11 +146,7 @@ function execute(
148146
end
149147
end
150148
seekstart(io) # rewind iobuffer so future user read will begin from start
151-
if -2 == status_code
152-
level(LOGGER, Errors.JLResultError(
153-
"PQgetCopyData error: $(error_message(jl_conn))"
154-
))
155-
end
149+
-2 == status_code && level(LOGGER, Errors.JLResultError("PQgetCopyData error: $(error_message(jl_conn))"))
156150

157151
libpq_c.PQgetResult(jl_conn.conn)
158152
end

0 commit comments

Comments
 (0)