@@ -135,6 +135,48 @@ pub enum SoarError {
135135 #[ error( transparent) ]
136136 #[ diagnostic( code( soar:: regex) , help( "Check your regex pattern syntax" ) ) ]
137137 RegexError ( #[ from] regex:: Error ) ,
138+
139+ #[ error( "Landlock is not supported on this system" ) ]
140+ #[ diagnostic(
141+ code( soar:: sandbox:: not_supported) ,
142+ help( "Landlock requires Linux kernel 5.13+. Hooks will run without sandboxing." )
143+ ) ]
144+ SandboxNotSupported ,
145+
146+ #[ error( "Failed to create Landlock ruleset: {0}" ) ]
147+ #[ diagnostic(
148+ code( soar:: sandbox:: ruleset) ,
149+ help( "This may indicate a kernel or permission issue" )
150+ ) ]
151+ SandboxRulesetCreation ( String ) ,
152+
153+ #[ error( "Failed to add sandbox rule for path '{path}': {reason}" ) ]
154+ #[ diagnostic(
155+ code( soar:: sandbox:: path_rule) ,
156+ help( "Check if the path exists and is accessible" )
157+ ) ]
158+ SandboxPathRule { path : String , reason : String } ,
159+
160+ #[ error( "Failed to add sandbox network rule for port {port}: {reason}" ) ]
161+ #[ diagnostic(
162+ code( soar:: sandbox:: network_rule) ,
163+ help( "Network restrictions require Landlock V4+ (kernel 6.7+)" )
164+ ) ]
165+ SandboxNetworkRule { port : u16 , reason : String } ,
166+
167+ #[ error( "Failed to enforce Landlock sandbox: {0}" ) ]
168+ #[ diagnostic(
169+ code( soar:: sandbox:: enforcement) ,
170+ help( "This may indicate a kernel or permission issue" )
171+ ) ]
172+ SandboxEnforcement ( String ) ,
173+
174+ #[ error( "Sandboxed command execution failed: {0}" ) ]
175+ #[ diagnostic(
176+ code( soar:: sandbox:: execution) ,
177+ help( "Check the command and sandbox configuration" )
178+ ) ]
179+ SandboxExecution ( String ) ,
138180}
139181
140182impl SoarError {
0 commit comments