Plot service, check error properly when database query fails