GW2FileErrorMsg
Fungsi GW2FileErrorMsg mendapatkan semula mesej ralat yang dilaporkan oleh Glasswall untuk session ID tertentu. Mesej ralat diletakkan dalam penimbal output.
Jika terdapat lebih daripada satu sebab bagi ralat tersebut, hanya satu akan dilaporkan oleh panggilan fungsi ini. Jika butiran diperlukan untuk kegagalan itu, butiran tersebut akan terdapat dalam laporan analisis yang dihasilkan jika salah satu fungsi GW2RegisterAnalysisFile atau GW2AnalysisRegisterMemory dipanggil pada sesi tersebut. Jika tidak, dokumen boleh diproses oleh Glasswall menggunakan salah satu fungsi tersebut dalam sesi lain untuk menghasilkan laporan analisis terperinci.
- C++
- C#
- Java
- Python
- JavaScript
Sinopsis
#include "glasswall.core2.api.h"
// The **GW2FileErrorMsg** function retrieves the error message reported by Glasswall.
// A pointer to the error message is placed in the object pointed to by **errorMsgBuffer**
// and the size, in bytes, of the error message is placed in the **size_t** object
// pointed to by **errorMsgBufferLength**.
int GW2FileErrorMsg(
Session session,
char **errorMsgBuffer,
size_t *errorMsgBufferLength);
Pulangan
Mengembalikan nilai enum integer GW2_RetStatus. Nombor negatif menunjukkan kegagalan.
Sinopsis
/// <summary>
///
/// </summary>
/// <param name="session">Session ID number</param>
/// <param name="outputBuffer">Location in memory where the error message will be placed</param>
/// <param name="bufferLength">Size of the output buffer</param>
public int FileErrorMsg(
int session,
out IntPtr outputBuffer,
ref UIntPtr bufferLength)
Pulangan
Mengembalikan nilai enum integer GW2_RetStatus. Nombor negatif menunjukkan kegagalan.
Sinopsis
import com.glasswall.core2javabridge.*;
public String GW2FileErrorMsgString(int session) throws GlasswallException
Nota
Parameter fungsi GW2FileErrorMsgString telah dikemas kini untuk menggunakan String menggantikan byte[], dan untuk menghapuskan keperluan memanggil GetErrorBuffer bagi mendapatkan data. Fungsi asal telah ditandakan sebagai deprecated.
Pulangan
GW2FileErrorMsgString mengembalikan String yang mengandungi mesej ralat sesi. String akan kosong jika tiada mesej ralat untuk diambil.
Pengecualian GlasswallException akan dilemparkan jika session tidak sah, atau jika mesej ralat tidak dapat diambil.
Sinopsis - Fungsi Ditamatkan
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2FileErrorMsg(int session) throws GlasswallException
public byte[] GetErrorBuffer(int session) throws GlasswallException
Penerangan
Fungsi GW2FileErrorMsg mengeluarkan mesej ralat fail untuk sesi yang ditentukan oleh session ke penimbal dalaman. Panggil GetErrorBuffer selepas memanggil GW2RunSession untuk mendapatkan data mesej ralat.
Rujuk API Overview/Return types untuk enumerator yang sah bagi format.
Pulangan - Fungsi Ditamatkan
Fungsi GW2FileErrorMsg mengembalikan enumerasi GW2_RetStatus yang ditukarkan kepada int. Nilainya akan negatif jika ralat berlaku. 0 menunjukkan kejayaan. Rujuk API Overview/Return types untuk butiran.
Fungsi GetErrorBuffer mengembalikan tatasusunan bait yang mengandungi butiran ralat. Ini akan menjadi null jika GW2FileErrorMsg belum dipanggil.
Pengecualian GlasswallException akan dilemparkan jika session tidak sah, atau jika mesej ralat tidak dapat diambil.
Sinopsis
Dapatkan mesej ralat Glasswall Session Process.
def file_error_message(self, session: int) -> str:
""" Retrieve the Glasswall Session Process error message.
Args:
session (int): The session integer.
Returns:
error_message (str): The Glasswall Session Process error message.
"""
Pulangan
Mesej ralat sebagai rentetan.
Sinopsis
/**
* This function retrieves the error message reported by Glasswall. If more than one error
* is reported, the last one will be returned.
*
*/
GW2FileErrorMsg(
session,
errorMsgBuffer,
errorMsgBufferLength)
Pulangan
Mengembalikan nilai enum integer GW2_RetStatus. Nombor negatif menunjukkan kegagalan.
Contoh
function getFileErrorMsg(session_id, gw) {
/*
GW2FileErrorMsg API signature
int GW2FileErrorMsg(
Session session,
char **errorMsgBuffer,
size_t *errorMsgBufferLength
);
*/
// allocate pointer space to store the pointer to the message buffer
let CString_ptr = ref.refType(ref.types.CString);
let errorMsgBuffer = ref.alloc(CString_ptr);
// allocate space to store the buffer length; use .deref() to extract it
let errorMsgBufferLength = ref.alloc('size_t');
let rv = gw.GW2FileErrorMsg(session_id, errorMsgBuffer, errorMsgBufferLength);
buf_len = errorMsgBufferLength.deref();
if (buf_len == 0)
arr_buf = "";
else
arr_buf = buffer_to_array(errorMsgBuffer, errorMsgBufferLength);
let message = `\n GW2FileErrorMsg:return=${rv}`;
message += "\n errorMsgBuffer = \"" + arr_buf.toString() + '"';
message += `\n errorMsgBufferLength = ${buf_len}`;
return message;
}