爲什麼錯誤消息在本地計算機中正確顯示,但不在QA UAT和prod計算機中?可能的原因是什麼?
I have written code for file upload which will allow only some particular files. If user will upload any wrong extension type of file, it will through error from the backend. I am doing all the validaton from backend only. Error message is showing very nicely in my local machine. But when i deploy the code on QA UAT or prod error message is not showing. I am getting Typeerror: canot read property '0' of undefined
In local we are notminifying the code. But in all other env it is minified.
下面是我爲前端編寫的代碼。
scope.uploadFile = function (fileModel) {
Upload.upload({
url: scope.url,
method: 'POST',
fields: {'requestId': scope.requestId, 'type': scope.type, 'isFileExisted' : fileModel.isFileExisted},
file: fileModel.file,
fileFormDataName: 'myFile',
sendFieldsAs: scope.form
}).progress(function (evt) { // Progress bar.
fileModel.completion = parseInt(100.0 * evt.loaded/evt.total);
}).success(function (data, status, headers, config) {
fileModel.serverMessage = 'File uploaded successfully';
fileModel.status = '200';
fileModel.id = data.id;
scope.onUpload({document: data});
}).error(function (data, status, headers, config) {
fileModel.status = '500';
fileModel.serverMessage = data.errors[0].message;
return false;
});
};
def validateDocument(String type, def file, def requestObj) {
String errMsg
\t \t \t if(type == 'treasury')
\t \t \t {
\t \t \t \t if (documents.findAll({ it.documentType == DocumentType.My_DOCUMENTS }).size() >= 5)
\t \t \t \t {
\t \t \t \t \t errMsg = "Maximum 5 attachments are allowed."
\t \t \t \t }
\t \t \t \t else if (documents.findAll{ it.documentType == DocumentType.My_DOCUMENTS }.find { it.fileName == file.originalFilename })
\t \t \t \t {
\t \t \t \t \t errMsg = "File with same name already exists."
\t \t \t \t }
\t \t \t }
\t if (file.getSize() >= (1024 * 1024 * 5))
\t \t \t {
errMsg = "File size cannot exceed 5 MB."
}
\t \t \t else if (!(mediaType == 'application/x-tika-ooxml' || mediaType == 'application/pdf'))
\t \t \t {
errMsg = "Invalid file format. Please add .doc .docx .xls .xlsx .pdf only"
}
\t \t \t else if (file.empty)
\t \t \t {
errMsg = "File cannot be empty."
}
}
errMsg
}
Please see the attached image in which i have marked an arrow, where
i am not getting error message.
由於縮小而產生嗎? –
@ [http://stackoverflow.com/users/949476/dfsq]你能幫助嗎? –