GW2FileErrorMsg
ฟังก์ชัน GW2FileErrorMsg จะดึงข้อความแสดงข้อผิดพลาดที่ Glasswall รายงานสำหรับ session ID ที่กำหนด โดยข้อความแสดงข้อผิดพลาดจะถูกวางไว้ในบัฟเฟอร์เอาต์พุต
หากมีสาเหตุของข้อผิดพลาดมากกว่าหนึ่งข้อ การเรียกใช้ฟังก์ชันนี้จะรายงานเพียงหนึ่งข้อเท่านั้น หากต้องการรายละเอียดของความล้มเหลว รายละเอียดดังกล่าวจะอยู่ในรายงานการวิเคราะห์ที่สร้างขึ้นหากมีการเรียกใช้ฟังก์ชัน GW2RegisterAnalysisFile หรือ GW2AnalysisRegisterMemory กับเซสชันนั้น หากไม่มี สามารถประมวลผลเอกสารด้วย Glasswall โดยใช้ฟังก์ชันใดฟังก์ชันหนึ่งดังกล่าวในอีกเซสชันหนึ่งเพื่อสร้างรายงานการวิเคราะห์โดยละเอียดได้
- C++
- C#
- Java
- Python
- JavaScript
สรุป
#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);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
/// <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)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public String GW2FileErrorMsgString(int session) throws GlasswallException
หมายเหตุ
พารามิเตอร์ของฟังก์ชัน GW2FileErrorMsgString ได้รับการอัปเดตให้ใช้ String แทน byte[] และเพื่อลดความจำเป็นในการเรียก GetErrorBuffer เพื่อดึงข้อมูล ฟังก์ชันดั้งเดิมถูกเลิกใช้งานแล้ว
ส่งกลับ
GW2FileErrorMsgString จะส่งกลับ String ที่มีข้อความแสดงข้อผิดพลาดของเซสชัน โดย String จะว่างเปล่าหากไม่มีข้อความแสดงข้อผิดพลาดให้ดึงข้อมูล
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง หรือหากไม่สามารถดึงข้อความแสดงข้อผิดพลาดได้
สรุป - ฟังก์ชันที่เลิกใช้แล้ว
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2FileErrorMsg(int session) throws GlasswallException
public byte[] GetErrorBuffer(int session) throws GlasswallException
คำอธิบาย
ฟังก์ชัน GW2FileErrorMsg จะส่งออกข้อความแสดงข้อผิดพลาดของไฟล์สำหรับเซสชันที่ระบุโดย session ไปยังบัฟเฟอร์ภายใน เรียก GetErrorBuffer หลังจากเรียก GW2RunSession เพื่อดึงข้อมูลข้อความแสดงข้อผิดพลาดกลับมา
โปรดดู API Overview/Return types สำหรับ enumerator ที่ใช้ได้ของ format.
ค่าที่ส่งกลับ - ฟังก์ชันที่เลิกใช้แล้ว
ฟังก์ชัน GW2FileErrorMsg จะส่งกลับ enumeration GW2_RetStatus ที่แปลงเป็น int ค่าเป็นลบจะหมายถึงเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดู API Overview/Return types สำหรับรายละเอียด
ฟังก์ชัน GetErrorBuffer จะส่งกลับอาร์เรย์ไบต์ที่มีรายละเอียดข้อผิดพลาด โดยจะเป็น null หากยังไม่ได้เรียก GW2FileErrorMsg
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง หรือหากไม่สามารถดึงข้อความแสดงข้อผิดพลาดได้
สรุป
ดึงข้อความแสดงข้อผิดพลาดของ 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.
"""
ส่งกลับ
ข้อความแสดงข้อผิดพลาดในรูปแบบสตริง
สรุป
/**
* 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)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
ตัวอย่าง
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;
}