@@ -225,7 +225,9 @@ def create_collection(self, collection=None, bucket=None,
225
225
headers = headers )
226
226
except KintoException as e :
227
227
if e .response .status_code == 403 :
228
- msg = "Unauthorized. Please check that the bucket exists."
228
+ msg = ("Unauthorized. Please check that the bucket exists and "
229
+ "that you have the permission to create or write this "
230
+ "collection." )
229
231
e = KintoException (msg , e )
230
232
raise e
231
233
return resp
@@ -290,9 +292,18 @@ def create_record(self, data, id=None, collection=None, permissions=None,
290
292
headers = DO_NOT_OVERWRITE if safe else None
291
293
292
294
endpoint = self ._get_endpoint ('record' , bucket , collection , id )
293
- resp , _ = self .session .request ('put' , endpoint , data = data ,
294
- permissions = permissions ,
295
- headers = headers )
295
+ try :
296
+ resp , _ = self .session .request ('put' , endpoint , data = data ,
297
+ permissions = permissions ,
298
+ headers = headers )
299
+ except KintoException as e :
300
+ if e .response .status_code == 403 :
301
+ msg = ("Unauthorized. Please check that the collection exists "
302
+ "and that you have the permission to create or write "
303
+ "this record." )
304
+ e = KintoException (msg , e )
305
+ raise e
306
+
296
307
return resp
297
308
298
309
def update_record (self , data , id = None , collection = None , permissions = None ,
0 commit comments