I would assume ioexception belongs in getPath, no? If the path is readable,
is there a chance of IOE in getOwner?
 On Sep 14, 2013 8:43 AM, "Josh Albrecht" <notifications@github.com> wrote:

> In src/main/scala/com/codexica/s3crate/filetree/local/LinuxFileTree.scala:
>
> > @@ -28,7 +89,17 @@ class LinuxFileTree(baseFolder: File, ec: ExecutionContext) extends LocalFileTre
> >     * @throws InaccessibleDataError wrapping all other non fatal errors
> >     * @return Return the appropriate FilePathType (folder, file, or symlink)
> >     */
> > -  def getOwner(file: File): String = throw new NotImplementedError()
> > +  def getOwner(file: File): String = {
> > +    //get Path from File
> > +    val path = getPath(file)
> > +    try {
> > +      //pretty straightforward, no?
> > +      Files.getOwner(path).getName()
> > +    } catch {
> > +      //and of course, if an exception was thrown somewhere, wrap it in InaccessibleDataError and re-throw
> > +      case ex => throw new InaccessibleDataError("exception trying to find file owner", ex)
>
> Almost straightforward :) We just have to be careful to do the right thing
> for each documented Exception, and then handle any other undocumented
> exceptions in the right way when they occur:
>
> } catch {
>   case e :IOException => throw new InaccessibleDataError(s"Error while getting owner of $file.toURI because $e.getMessage", e)
>   case e: SecurityException => throw new FilePermissionError(s"Could not get owner of $file.toURI because $e.getMessage", e)
>   //happens if you try to run this on windows, should propagate because it represents a higher level error
>   case e: UnsupportedOperationException => throw e
> }
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/joshalbrecht/s3crate/pull/1/files#r6364059>
> .
>