Android पर Cloud Storage के लिए गड़बड़ियां मैनेज करना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
कभी-कभी, प्लान के मुताबिक काम नहीं होता और कोई गड़बड़ी हो जाती है.
अगर आपको कोई गड़बड़ी दिखती है, तो गड़बड़ी का मैसेज देखें और जानें कि गड़बड़ी किस वजह से हुई है.
नीचे दिए गए कोड में, कस्टम गड़बड़ी हैंडलर को लागू करने का तरीका दिखाया गया है. यह Cloud Storage से मिले गड़बड़ी कोड और गड़बड़ी के मैसेज की जांच करता है. इस तरह के गड़बड़ी हैंडलर, Cloud Storage एपीआई में इस्तेमाल किए गए अलग-अलग ऑब्जेक्ट में जोड़े जा सकते हैं. उदाहरण के लिए, UploadTask और FileDownloadTask.
Kotlin
internalinnerclassMyFailureListener:OnFailureListener{overridefunonFailure(exception:Exception){valerrorCode=(exceptionasStorageException).errorCodevalerrorMessage=exception.message// test the errorCode and errorMessage, and handle accordingly}}
classMyFailureListenerimplementsOnFailureListener{@OverridepublicvoidonFailure(@NonNullExceptionexception){interrorCode=((StorageException)exception).getErrorCode();StringerrorMessage=exception.getMessage();// test the errorCode and errorMessage, and handle accordingly}}
अगर आपने गड़बड़ी का मैसेज देख लिया है और आपके पास Cloud Storage Security Rules हैं, लेकिन अब भी गड़बड़ी ठीक नहीं हो रही है, तो हमारे सहायता पेज पर जाएं और हमें बताएं कि हम आपकी मदद कैसे कर सकते हैं.
गड़बड़ी के मैसेज मैनेज करना
गड़बड़ियां होने की कई वजहें हो सकती हैं. जैसे, फ़ाइल मौजूद न होना, उपयोगकर्ता के पास फ़ाइल को ऐक्सेस करने की अनुमति न होना या उपयोगकर्ता का फ़ाइल अपलोड रद्द करना.
समस्या का पता लगाने और गड़बड़ी को ठीक करने के लिए, यहां उन सभी गड़बड़ियों की पूरी सूची दी गई है जो हमारा क्लाइंट दिखाएगा. साथ ही, यह भी बताया गया है कि ये गड़बड़ियां कैसे हो सकती हैं. इस टेबल में दिए गए गड़बड़ी कोड, StorageException क्लास में पूर्णांक स्थिरांक के तौर पर तय किए गए हैं.
कोड
वजह
ERROR_UNKNOWN
कोई अनजानी गड़बड़ी हुई.
ERROR_OBJECT_NOT_FOUND
दिए गए रेफ़रंस पर कोई ऑब्जेक्ट मौजूद नहीं है.
ERROR_BUCKET_NOT_FOUND
Cloud Storage के लिए कोई बकेट कॉन्फ़िगर नहीं की गई है
ERROR_PROJECT_NOT_FOUND
Cloud Storage के लिए कोई प्रोजेक्ट कॉन्फ़िगर नहीं किया गया है
ERROR_QUOTA_EXCEEDED
आपकी Cloud Storage बकेट का कोटा खत्म हो गया है. अगर आपने Spark प्लान लिया है, तो इस्तेमाल के हिसाब से शुल्क चुकाने वाले Blaze प्लान पर अपग्रेड करें. अगर आपने पहले से ही ब्लेज़ प्लान लिया हुआ है, तो Firebase की सहायता टीम से संपर्क करें.
उपयोगकर्ता की पुष्टि नहीं हुई है. कृपया पुष्टि करें और फिर से कोशिश करें.
ERROR_NOT_AUTHORIZED
उपयोगकर्ता को अनुरोध की गई कार्रवाई करने की अनुमति नहीं है. यह पक्का करने के लिए अपने नियमों की जांच करें कि वे सही हैं.
ERROR_RETRY_LIMIT_EXCEEDED
किसी कार्रवाई (अपलोड, डाउनलोड, मिटाना वगैरह) के लिए तय की गई समयसीमा खत्म हो गई है. फिर से कोशिश करें.
ERROR_INVALID_CHECKSUM
क्लाइंट पर मौजूद फ़ाइल का चेकसम, सर्वर को मिली फ़ाइल के चेकसम से मेल नहीं खाता. फिर से अपलोड करके देखें.
ERROR_CANCELED
उपयोगकर्ता ने कार्रवाई रद्द कर दी है.
इसके अलावा, अमान्य यूआरएल से getReferenceFromUrl() को कॉल करने पर, IllegalArgumentException से गड़बड़ी का मैसेज मिलेगा. ऊपर दिए गए तरीके के लिए, आर्ग्युमेंट gs://bucket/object या https://firebasestorage.googleapis.com/v0/b/bucket/o/object?token=<TOKEN> के फ़ॉर्म में होना चाहिए
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-09-05 (UTC) को अपडेट किया गया."],[],[],null,["\u003cbr /\u003e\n\nSometimes things don't go as planned and an error occurs.\n\nWhen in doubt, check the error returned and see what the error message says.\nThe following code shows a custom error handler implementation that inspects\nthe error code and error message returned by Cloud Storage. Such error\nhandlers can be added to various objects used in the Cloud Storage API (for\nexample, `UploadTask` and `FileDownloadTask`). \n\nKotlin \n\n```kotlin\ninternal inner class MyFailureListener : OnFailureListener {\n override fun onFailure(exception: Exception) {\n val errorCode = (exception as StorageException).errorCode\n val errorMessage = exception.message\n // test the errorCode and errorMessage, and handle accordingly\n }\n}https://github.com/firebase/snippets-android/blob/cc307b137a106d66a52fa6e9bee6f4f55dab9f76/storage/app/src/main/java/com/google/firebase/referencecode/storage/kotlin/StorageActivity.kt#L492-L498\n```\n\nJava \n\n```java\nclass MyFailureListener implements OnFailureListener {\n @Override\n public void onFailure(@NonNull Exception exception) {\n int errorCode = ((StorageException) exception).getErrorCode();\n String errorMessage = exception.getMessage();\n // test the errorCode and errorMessage, and handle accordingly\n }\n}https://github.com/firebase/snippets-android/blob/cc307b137a106d66a52fa6e9bee6f4f55dab9f76/storage/app/src/main/java/com/google/firebase/referencecode/storage/StorageActivity.java#L618-L625\n```\n\nIf you've checked the error message and have Cloud Storage Security Rules that allow your\naction, but are still struggling to fix the error, visit our\n[Support page](/support) and let us know how we can help.\n\nHandle Error Messages\n\nThere are a number of reasons why errors may occur, including the file\nnot existing, the user not having permission to access the desired file, or the\nuser cancelling the file upload.\n\nTo properly diagnose the issue and handle the error, here is a full list of all\nthe errors our client will raise, and how they can occur. Error codes in this\ntable are defined in the `StorageException` class as integer constants.\n\n| Code | Reason |\n|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ERROR_UNKNOWN` | An unknown error occurred. |\n| `ERROR_OBJECT_NOT_FOUND` | No object exists at the specified reference. |\n| `ERROR_BUCKET_NOT_FOUND` | No bucket is configured for Cloud Storage |\n| `ERROR_PROJECT_NOT_FOUND` | No project is configured for Cloud Storage |\n| `ERROR_QUOTA_EXCEEDED` | Quota on your Cloud Storage bucket has been exceeded. If you're on the Spark pricing plan, consider upgrading to the [pay-as-you-go Blaze pricing plan](/pricing). If you're already on the Blaze pricing plan, reach out to Firebase Support. **Important** : Starting October 1, 2025, the [Blaze pricing plan will be *required* to use Cloud Storage](/docs/storage/faqs-storage-changes-announced-sept-2024), even default buckets. |\n| `ERROR_NOT_AUTHENTICATED` | User is unauthenticated, please authenticate and try again. |\n| `ERROR_NOT_AUTHORIZED` | User is not authorized to perform the requested action, check your rules to ensure they are correct. |\n| `ERROR_RETRY_LIMIT_EXCEEDED` | The maximum time limit on an operation (upload, download, delete, etc.) has been excceded. Try again. |\n| `ERROR_INVALID_CHECKSUM` | File on the client does not match the checksum of the file received by the server. Try uploading again. |\n| `ERROR_CANCELED` | User canceled the operation. |\n\nAdditionally, attempting to call `getReferenceFromUrl()` with an invalid URL\nwill result in an `IllegalArgumentException` from being thrown. The argument to\nthe above method must be of the form `gs://bucket/object` or\n`https://firebasestorage.googleapis.com/v0/b/bucket/o/object?token=\u003cTOKEN\u003e`"]]