Skip to content

Commit 4d5dd53

Browse files
committed
config: log user and profile in patch errors
1 parent f0cdcd8 commit 4d5dd53

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

http-service/src/main/java/net/runelite/http/service/config/ConfigService.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import com.google.common.base.Strings;
2828
import com.google.gson.Gson;
29+
import com.mongodb.MongoCommandException;
2930
import com.mongodb.client.MongoClient;
3031
import com.mongodb.client.MongoCollection;
3132
import com.mongodb.client.MongoCursor;
@@ -350,11 +351,20 @@ public ConfigPatchResult patchV3(int userId, long profileId, ConfigPatch patch)
350351
// marks it as unsynced when the client restarts next.
351352
Long rev = null;
352353
sets.add(INCREMENT_REV);
353-
Document newRev = mongoCollection.findOneAndUpdate(
354-
profileFilter(userId, profileId),
355-
combine(sets),
356-
upsertFindAndUpdateOptions
357-
);
354+
Document newRev;
355+
try
356+
{
357+
newRev = mongoCollection.findOneAndUpdate(
358+
profileFilter(userId, profileId),
359+
combine(sets),
360+
upsertFindAndUpdateOptions
361+
);
362+
}
363+
catch (MongoCommandException ex)
364+
{
365+
log.error("error patching profile {} for user {} edits: {} unsets: {}", profileId, userId, patch.getEdit().size(), patch.getUnset().size());
366+
throw ex;
367+
}
358368
if (newRev != null)
359369
{
360370
rev = ((Document) newRev.get("_profile")).getLong("rev");

0 commit comments

Comments
 (0)