Skip to content

Commit

Permalink
Fix compiler error & exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Aug 19, 2024
1 parent 030bfd3 commit e3a39d8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/Lumina/Excel/BaseExcelSheet.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Lumina.Data;
using Lumina.Data.Files.Excel;
using Lumina.Data.Structs.Excel;
using Lumina.Excel.Exceptions;
using Lumina.Extensions;
using System;
using System.Collections.Frozen;
Expand Down
1 change: 1 addition & 0 deletions src/Lumina/Excel/ExcelModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Lumina.Data.Structs.Excel;
using Lumina.Excel.Exceptions;

namespace Lumina.Excel;

Expand Down
1 change: 1 addition & 0 deletions src/Lumina/Excel/ExcelSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Runtime.CompilerServices;
using Lumina.Data;
using Lumina.Data.Structs.Excel;
using Lumina.Excel.Exceptions;

namespace Lumina.Excel;

Expand Down
1 change: 1 addition & 0 deletions src/Lumina/Excel/SubrowExcelSheet.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Lumina.Data;
using Lumina.Excel.Exceptions;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
17 changes: 5 additions & 12 deletions src/Lumina/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Lumina.Data.Structs;
using Lumina.Data.Structs.Excel;
using Lumina.Excel;
using Lumina.Excel.Exceptions;
using Lumina.Misc;

// ReSharper disable MemberCanBePrivate.Global
Expand Down Expand Up @@ -296,19 +297,15 @@ public static UInt64 GetFileHash( string path )
/// language-neutral sheet using <see cref="Language.None"/> will be loaded instead. If the language-neutral sheet does not exist, then the function
/// will return <see langword="null"/>.
/// </remarks>
/// <exception cref="InvalidCastException">Sheet is not of the variant <see cref="ExcelVariant.Default"/>.</exception>
/// <exception cref="InvalidOperationException"><typeparamref name="T"/> does not have a valid <see cref="SheetAttribute"/>.</exception>
/// <exception cref="SheetNameEmptyException">Sheet name was not specified neither via <typeparamref name="T"/>'s <see cref="SheetAttribute.Name"/> nor <paramref name="name"/>.</exception>
/// <exception cref="SheetAttributeMissingException"><typeparamref name="T"/> does not have a valid <see cref="SheetAttribute"/>.</exception>
public ExcelSheet< T >? GetExcelSheet< T >( Language? language = null, string? name = null ) where T : struct, IExcelRow< T >
{
try
{
return Excel.GetSheet< T >( language, name );
}
catch( ArgumentException )
{
return null;
}
catch( NotSupportedException )
catch( Exception e ) when ( e is SheetNotFoundException or MismatchedColumnHashException or NotSupportedException or UnsupportedLanguageException )
{
return null;
}
Expand All @@ -323,11 +320,7 @@ public static UInt64 GetFileHash( string path )
{
return Excel.GetSubrowSheet< T >( language, name );
}
catch( ArgumentException )
{
return null;
}
catch ( NotSupportedException )
catch( Exception e ) when ( e is SheetNotFoundException or MismatchedColumnHashException or NotSupportedException or UnsupportedLanguageException )
{
return null;
}
Expand Down

0 comments on commit e3a39d8

Please sign in to comment.