GW2FileErrorMsg
Kinukuha ng function na GW2FileErrorMsg ang mensahe ng error na iniulat ng Glasswall para sa isang ibinigay na session ID. Inilalagay ang mensahe ng error sa isang output buffer.
Kung may higit sa isang dahilan para sa error, isa lamang ang iuulat ng tawag sa function na ito. Kung kailangan ang mga detalye para sa pagkabigo, makikita ang mga ito sa analysis report na ginawa kung alinman sa mga function na GW2RegisterAnalysisFile o GW2AnalysisRegisterMemory ay tinawag sa session. Kung hindi, maaaring iproseso ng Glasswall ang dokumento gamit ang alinman sa mga function na iyon sa ibang session upang makagawa ng detalyadong analysis report.
- C++
- C#
- Java
- Python
- JavaScript
Buod
#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);
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
/// <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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
import com.glasswall.core2javabridge.*;
public String GW2FileErrorMsgString(int session) throws GlasswallException
Tandaan
Na-update ang mga parameter ng function na GW2FileErrorMsgString upang gumamit ng String kapalit ng byte[], at upang alisin ang pangangailangang tawagin ang GetErrorBuffer para makuha ang data. Ang mga orihinal na function ay deprecated na.
Ibinabalik
Ang GW2FileErrorMsgString ay nagbabalik ng isang String na naglalaman ng mga mensahe ng error ng session. Magiging walang laman ang String kung walang mga mensahe ng error na makukuha.
Isang exception na GlasswallException ang ihahagis kung hindi wasto ang session, o kung hindi makuha ang mensahe ng error.
Buod - Mga Hindi na Inirerekomendang Function
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2FileErrorMsg(int session) throws GlasswallException
public byte[] GetErrorBuffer(int session) throws GlasswallException
Paglalarawan
Ang function na GW2FileErrorMsg ay naglalabas ng mensahe ng error ng file para sa session na tinukoy ng session sa isang internal buffer. Tawagin ang GetErrorBuffer pagkatapos tawagin ang GW2RunSession upang makuha ang data ng mensahe ng error.
Sumangguni sa API Overview/Return types para sa mga wastong enumerator para sa format.
Mga Return - Mga Hindi na Inirerekomendang Function
Ang function na GW2FileErrorMsg ay nagbabalik ng isang enumerasyon na GW2_RetStatus na kino-convert sa int. Magiging negatibo ang value kung may naganap na error. Ang 0 ay nagpapahiwatig ng tagumpay. Sumangguni sa API Overview/Return types para sa mga detalye.
Ang function na GetErrorBuffer ay nagbabalik ng byte array na naglalaman ng mga detalye ng error. Ito ay magiging null kung hindi pa natawag ang GW2FileErrorMsg.
Isang exception na GlasswallException ang ihahagis kung hindi wasto ang session, o kung hindi makuha ang mensahe ng error.
Buod
Kunin ang mensahe ng error ng 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.
"""
Ibinabalik
Isang mensahe ng error bilang isang string.
Buod
/**
* 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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Halimbawa
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;
}