From cbf13630a9ae66f549450daee1578a6d1540deb7 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 1 Feb 2022 01:03:10 +0900 Subject: [PATCH] internal/uidriver/glfw: remove an unnecessary error handling --- internal/uidriver/glfw/ui_windows.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/uidriver/glfw/ui_windows.go b/internal/uidriver/glfw/ui_windows.go index 735b66e15..f165547dc 100644 --- a/internal/uidriver/glfw/ui_windows.go +++ b/internal/uidriver/glfw/ui_windows.go @@ -53,11 +53,10 @@ var ( ) func getSystemMetrics(nIndex int) (int32, error) { - r, _, e := procGetSystemMetrics.Call(uintptr(nIndex)) + r, _, _ := procGetSystemMetrics.Call(uintptr(nIndex)) if r == 0 { - if e != nil && e != windows.ERROR_SUCCESS { - return 0, fmt.Errorf("glfw: GetSystemMetrics failed: error code: %w", e) - } + // GetLastError doesn't provide an extended information. + // See https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics return 0, fmt.Errorf("glfw: GetSystemMetrics returned 0") } return int32(r), nil