Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PostgresORM"
uuid = "748b5efa-ed57-4836-b183-a38105a77fdd"
authors = ["Vincent Laugier <vincent.laugier@gmail.com>"]
version = "0.6.0"
version = "0.6.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
15 changes: 11 additions & 4 deletions src/Controller/coreORM.update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,17 @@ function update_entity!(updated_object::IEntity,
dbconn)

if length(previous_state) == 0
throw(DomainError("Unable to retrieve an object of type[$data_type] "
* "with id[$(getproperty(updated_object,
orm_module.id_property))] from the database."
*" Remind that only existing existing objects can be updated."))

id_for_display = util_get_ids_cols_names_and_values(updated_object, dbconn) |>
dict -> join(["$k: $v" for (k, v) in dict], ", ")

throw(
DomainError(
"Unable to retrieve an object of type[$data_type] "
*"with id[$id_for_display] "
*"from the database. Remind that only existing objects can be updated."
)
)
end

previous_state = previous_state[1]
Expand Down