Skip to content

Commit

Permalink
Better error handling 🔥
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiightmareXD committed Sep 6, 2024
1 parent 6853d4f commit 43b8ac9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
36 changes: 18 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@ documentation = "https://docs.rs/windows-capture"
readme = "README.md"
repository = "https://github.com/NiiightmareXD/windows-capture"
license = "MIT"
keywords = ["screen", "capture", "screenshot", "graphics", "windows"]
keywords = ["screenshot", "screen", "capture", "graphics", "windows"]
categories = [
"os::windows-apis",
"api-bindings",
"graphics",
"gui",
"multimedia",
"os::windows-apis",
]
resolver = "2"

[dependencies]
# Windows API
windows = { version = "0.58.0", features = [
"Win32_System_WinRT_Graphics_Capture",
"Win32_Graphics_Direct3D11",
"Win32_Foundation",
"Foundation_Metadata",
"Foundation",
"Graphics_Capture",
"Win32_System_WinRT_Direct3D11",
"Win32_System_Threading",
"Win32_UI_WindowsAndMessaging",
"Win32_Graphics_Dxgi_Common",
"Win32_Graphics_Direct3D",
"Win32_Graphics_Gdi",
"System",
"Graphics_DirectX_Direct3D11",
"Foundation_Metadata",
"Win32_Devices_Display",
"Storage",
"Graphics_Imaging",
"Storage_Streams",
"Foundation",
"Media_MediaProperties",
"Media_Core",
"Media_MediaProperties",
"Media_Transcoding",
"Security_Cryptography",
"Storage_Streams",
"Storage",
"System",
"Win32_Devices_Display",
"Win32_Foundation",
"Win32_Graphics_Direct3D",
"Win32_Graphics_Direct3D11",
"Win32_Graphics_Dxgi_Common",
"Win32_Graphics_Gdi",
"Win32_System_Threading",
"Win32_System_WinRT_Direct3D11",
"Win32_System_WinRT_Graphics_Capture",
"Win32_UI_WindowsAndMessaging",
] }

# Mutex optimization
Expand Down
6 changes: 3 additions & 3 deletions src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ pub enum GraphicsCaptureApiError<E> {
FailedToSetDispatcherQueueCompletedHandler,
#[error("Failed to convert item to GraphicsCaptureItem")]
ItemConvertFailed,
#[error("Graphics capture error")]
#[error("Graphics capture error: {0}")]
GraphicsCaptureApiError(graphics_capture_api::Error),
#[error("New handler error")]
#[error("New handler error: {0}")]
NewHandlerError(E),
#[error("Frame handler error")]
#[error("Frame handler error: {0}")]
FrameHandlerError(E),
}

Expand Down
4 changes: 2 additions & 2 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ impl ImageEncoder {
pub enum VideoEncoderError {
#[error("Windows API Error: {0}")]
WindowsError(#[from] windows::core::Error),
#[error("Frame send error")]
#[error("Frame send error: {0}")]
FrameSendError(#[from] mpsc::SendError<Option<(VideoEncoderSource, TimeSpan)>>),
#[error("Audio send error")]
#[error("Audio send error: {0}")]
AudioSendError(#[from] mpsc::SendError<Option<(AudioEncoderSource, TimeSpan)>>),
#[error("Video is disabled")]
VideoDisabled,
Expand Down
4 changes: 2 additions & 2 deletions windows-capture-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ struct InnerNativeWindowsCapture {

#[derive(thiserror::Error, Debug)]
pub enum InnerNativeWindowsCaptureError {
#[error("Python Callback Error")]
#[error("Python Callback Error: {0}")]
PythonError(pyo3::PyErr),
#[error("Frame Process Error")]
#[error("Frame Process Error: {0}")]
FrameProcessError(frame::Error),
}

Expand Down

0 comments on commit 43b8ac9

Please sign in to comment.